NEST  2.6.0,not_revisioned_source_dir@0
Public Member Functions | Private Attributes | Friends | List of all members

A type-independent container for C++-types. More...

#include <token.h>

Public Member Functions

 ~Token ()
 
 Token (const Token &c_s)
 
 Token (Datum *p_s=NULL)
 
 Token (const Datum &d)
 
 Token (int)
 
 Token (unsigned int)
 
 Token (long)
 
 Token (bool)
 
 Token (unsigned long)
 
 Token (double)
 
 Token (const char *)
 
 Token (std::string)
 
 Token (const std::vector< double > &)
 
 Token (const std::valarray< double > &)
 
 Token (const std::vector< long > &)
 
 Token (const std::vector< size_t > &)
 
 Token (const std::ostream &)
 
 Token (const std::istream &)
 
 operator Datum * () const
 
 operator size_t () const
 
 operator long () const
 
 operator double () const
 
 operator float () const
 
 operator bool () const
 
 operator std::string () const
 
void detach ()
 If the contained datum has more than one reference, clone it, so it can be modified. More...
 
void move (Token &c)
 
void init_move (Token &rhs)
 Initialize the token by moving a datum from another token. More...
 
void init_by_copy (const Token &rhs)
 Initialize the token by moving a datum from another token. More...
 
void init_by_ref (const Token &rhs)
 Initialize the token with a reference. More...
 
void init_by_pointer (Datum *rhs)
 Initialize the token with a datum pointer. More...
 
void assign_by_ref (const Token &rhs)
 
void assign_by_pointer (Datum *rhs)
 
void swap (Token &c)
 
void clear (void)
 
bool contains (const Datum &d) const
 
bool empty (void) const
 
bool operator! (void) const
 
Datum * datum (void) const
 
bool valid () const
 
Datum * operator-> () const
 
Datum & operator* () const
 
const std::type_info & type (void) const
 
Token & operator= (const Token &c_s)
 
Token & operator= (Datum *p_s)
 
bool operator== (const Token &t) const
 
bool operator!= (const Token &t) const
 
void info (std::ostream &) const
 
void pprint (std::ostream &) const
 
void clear_access_flag ()
 Clear accessed flag. More...
 
void set_access_flag () const
 
bool accessed () const
 Check for access. More...
 
template<typename DatumType >
bool is_a () const
 Check whether Token contains a Datum of a given type. More...
 
bool matches_as_string (const Token &rhs) const
 Returns true if token equals rhs as string. More...
 

Private Attributes

Datum * p
 
bool accessed_
 Flag for access control. More...
 

Friends

class Datum
 
class TokenArrayObj
 

Detailed Description

A type-independent container for C++-types.

Constructor & Destructor Documentation

Token::~Token ( )
inline

References p, and Datum::removeReference().

Token::Token ( const Token &  c_s)
inline

References Datum::get_ptr(), and p.

Token::Token ( Datum *  p_s = NULL)
inline
Parameters
p_suse existing pointer to datum, token takes responsibility of the pointer.
Token::Token ( const Datum &  d)
inline
Parameters
dcopy datum object and store its pointer.

References Datum::clone(), and p.

Token::Token ( int  value)

References p.

Token::Token ( unsigned int  value)

References p.

Token::Token ( long  value)

References p.

Token::Token ( bool  value)

References p.

Token::Token ( unsigned long  value)

References p.

Token::Token ( double  value)

References p.

Token::Token ( const char *  value)

References p.

Token::Token ( std::string  value)

References p.

Token::Token ( const std::vector< double > &  value)

References p.

Token::Token ( const std::valarray< double > &  value)

References p.

Token::Token ( const std::vector< long > &  value)

References p.

Token::Token ( const std::vector< size_t > &  value)

References p.

Token::Token ( const std::ostream &  )
Token::Token ( const std::istream &  )

Member Function Documentation

bool Token::accessed ( ) const
inline

Check for access.

Access control does not differentiate between read and write access, and relies on getValue<>, setValue<> to use datum() to access the data in the Token. The access flag should be cleared before entering the code for which access is to be checked.

References accessed_.

void Token::assign_by_pointer ( Datum *  rhs)
inline
void Token::assign_by_ref ( const Token &  rhs)
inline
void Token::clear ( void  )
inline

References p, and Datum::removeReference().

Referenced by Scanner::operator()(), and operator=().

void Token::clear_access_flag ( )
inline

Clear accessed flag.

References accessed_.

bool Token::contains ( const Datum &  d) const
inline
Datum* Token::datum ( void  ) const
inline

References accessed_, and p.

Referenced by accumulate_property(), SLIInterpreter::addlinkeddynmodule(), SLIInterpreter::addmodule(), append_property(), append_property< std::vector< double > >(), append_property< std::vector< long > >(), SLIArrayModule::IMapFunction::backtrace(), IiterateFunction::backtrace(), SLIArrayModule::IMap_ivFunction::backtrace(), SLIArrayModule::IMap_dvFunction::backtrace(), IloopFunction::backtrace(), IrepeatFunction::backtrace(), SLIArrayModule::IMapThreadFunction::backtrace(), IforFunction::backtrace(), SLIArrayModule::IMapIndexedFunction::backtrace(), IforallarrayFunction::backtrace(), IforalliterFunction::backtrace(), IforallindexedarrayFunction::backtrace(), IforallindexedstringFunction::backtrace(), IforallstringFunction::backtrace(), SLIArrayModule::Iforall_ivFunction::backtrace(), SLIArrayModule::Iforall_dvFunction::backtrace(), nest::ConnParameter::create(), nest::AbstractLayer::create_layer(), nest::TopologyModule::create_mask(), nest::TopologyModule::create_parameter(), SLIInterpreter::createcommand(), nest::Network::divergent_connect(), eq_execute(), TrieFunction::execute(), OOSupportModule::CallMemberFunction::execute(), Add_diFunction::execute(), TrieInfoFunction::execute(), FilesystemModule::FileNamesFunction::execute(), MathLinkPutStringFunction::execute(), Get_aFunction::execute(), NametypeFunction::execute(), NpopFunction::execute(), Add_iiFunction::execute(), SLIArrayModule::MapFunction::execute(), AddtotrieFunction::execute(), XIfstreamFunction::execute(), Get_a_aFunction::execute(), IsetcallbackFunction::execute(), ProceduretypeFunction::execute(), GNUReadline::GNUReadlineFunction::execute(), DictputFunction::execute(), RegexpModule::RegcompFunction::execute(), SLIgraphics::ReadPGMFunction::execute(), SLIArrayModule::IMapFunction::execute(), Add_idFunction::execute(), Cva_tFunction::execute(), IfstreamFunction::execute(), RegexpModule::RegexecFunction::execute(), GNUReadline::GNUAddhistoryFunction::execute(), IiterateFunction::execute(), LitproceduretypeFunction::execute(), DictgetFunction::execute(), SLIArrayModule::IMap_ivFunction::execute(), SLIgraphics::WritePGMFunction::execute(), Add_ddFunction::execute(), RegexpModule::RegerrorFunction::execute(), Cvt_aFunction::execute(), OfstreamFunction::execute(), Get_pFunction::execute(), DictbeginFunction::execute(), FunctiontypeFunction::execute(), SLIArrayModule::IMap_dvFunction::execute(), IloopFunction::execute(), IndexFunction::execute(), Sub_diFunction::execute(), OfsopenFunction::execute(), Get_lpFunction::execute(), SLIArrayModule::MapThreadFunction::execute(), LoopFunction::execute(), CallbacktypeFunction::execute(), IrepeatFunction::execute(), RollFunction::execute(), SLIArrayModule::IMapThreadFunction::execute(), Sub_iiFunction::execute(), SpecialFunctionsModule::GammaIncFunction::execute(), Append_aFunction::execute(), IsstreamFunction::execute(), IforFunction::execute(), SpecialFunctionsModule::LambertW0Function::execute(), SLIArrayModule::MapIndexedFunction::execute(), Append_pFunction::execute(), Sub_idFunction::execute(), DictinfoFunction::execute(), SpecialFunctionsModule::LambertWm1Function::execute(), SLIArrayModule::IMapIndexedFunction::execute(), IforallarrayFunction::execute(), Append_sFunction::execute(), TrietypeFunction::execute(), IfFunction::execute(), StrSStreamFunction::execute(), Sub_ddFunction::execute(), DicttopinfoFunction::execute(), SLIArrayModule::RangeFunction::execute(), SpecialFunctionsModule::ErfFunction::execute(), FilesystemModule::CompareFilesFunction::execute(), IforalliterFunction::execute(), Prepend_aFunction::execute(), IfelseFunction::execute(), SLIArrayModule::ArraystoreFunction::execute(), WhoFunction::execute(), nest::DynamicLoaderModule::UnloadModuleFunction::execute(), SpecialFunctionsModule::ErfcFunction::execute(), Mul_diFunction::execute(), Prepend_pFunction::execute(), RepeatFunction::execute(), IforallindexedarrayFunction::execute(), StrFunction::execute(), DictconstructFunction::execute(), SLIStartup::GetenvFunction::execute(), Prepend_sFunction::execute(), Mul_iiFunction::execute(), CopyFunction::execute(), IforallindexedstringFunction::execute(), PrintFunction::execute(), Join_sFunction::execute(), SLIArrayModule::ReverseFunction::execute(), Mul_idFunction::execute(), IforallstringFunction::execute(), PrettyprintFunction::execute(), Join_aFunction::execute(), SLIArrayModule::RotateFunction::execute(), CloseistreamFunction::execute(), Mul_ddFunction::execute(), SLIArrayModule::FlattenFunction::execute(), Join_pFunction::execute(), RestoreestackFunction::execute(), CloseostreamFunction::execute(), Insert_sFunction::execute(), Div_diFunction::execute(), RestoreostackFunction::execute(), FlushFunction::execute(), Length_dFunction::execute(), Insert_aFunction::execute(), SLIArrayModule::TransposeFunction::execute(), Div_iiFunction::execute(), EndlFunction::execute(), Empty_DFunction::execute(), InsertElement_sFunction::execute(), SLIArrayModule::PartitionFunction::execute(), EndsFunction::execute(), CleardictFunction::execute(), Div_idFunction::execute(), InsertElement_aFunction::execute(), IparseFunction::execute(), SLIArrayModule::ValidFunction::execute(), EatwhiteFunction::execute(), ClonedictFunction::execute(), Div_ddFunction::execute(), Replace_sFunction::execute(), DefFunction::execute(), SLIArrayModule::Put_a_a_tFunction::execute(), SetwFunction::execute(), UndefFunction::execute(), Replace_aFunction::execute(), SetFunction::execute(), Mod_iiFunction::execute(), SetprecisionFunction::execute(), KnownFunction::execute(), Erase_sFunction::execute(), LoadFunction::execute(), IOSFixedFunction::execute(), Cva_dFunction::execute(), Erase_aFunction::execute(), Sin_dFunction::execute(), LookupFunction::execute(), IOSScientificFunction::execute(), KeysFunction::execute(), Erase_pFunction::execute(), ForFunction::execute(), Asin_dFunction::execute(), IOSDefaultFunction::execute(), ValuesFunction::execute(), Forall_aFunction::execute(), Length_sFunction::execute(), IOSShowpointFunction::execute(), RestoredstackFunction::execute(), Cos_dFunction::execute(), SLIArrayModule::AreaFunction::execute(), Length_aFunction::execute(), Forall_iterFunction::execute(), IOSNoshowpointFunction::execute(), Acos_dFunction::execute(), Length_pFunction::execute(), Forallindexed_aFunction::execute(), IOSShowbaseFunction::execute(), Length_lpFunction::execute(), Exp_dFunction::execute(), Forallindexed_sFunction::execute(), IOSNoshowbaseFunction::execute(), Processes::WaitPIDFunction::execute(), Capacity_aFunction::execute(), Forall_sFunction::execute(), Ln_dFunction::execute(), IOSDecFunction::execute(), Processes::KillFunction::execute(), Size_aFunction::execute(), RaiseerrorFunction::execute(), IOSHexFunction::execute(), Log_dFunction::execute(), Reserve_aFunction::execute(), SLIArrayModule::Area2Function::execute(), Processes::Dup2_is_isFunction::execute(), IOSOctFunction::execute(), Sqr_dFunction::execute(), Processes::Dup2_os_osFunction::execute(), SLIArrayModule::Cv1dFunction::execute(), Resize_aFunction::execute(), IOSLeftFunction::execute(), Processes::Dup2_is_osFunction::execute(), SLIArrayModule::Cv2dFunction::execute(), Empty_aFunction::execute(), Sqrt_dFunction::execute(), Processes::Dup2_os_isFunction::execute(), IOSRightFunction::execute(), SLIArrayModule::GetMaxFunction::execute(), Processes::AvailableFunction::execute(), References_aFunction::execute(), Pow_ddFunction::execute(), IOSInternalFunction::execute(), SLIArrayModule::GetMinFunction::execute(), Shrink_aFunction::execute(), GetcFunction::execute(), Pow_diFunction::execute(), Capacity_sFunction::execute(), GetsFunction::execute(), Processes::MkfifoFunction::execute(), Modf_dFunction::execute(), Size_sFunction::execute(), GetlineFunction::execute(), Reserve_sFunction::execute(), Frexp_dFunction::execute(), IGoodFunction::execute(), Resize_sFunction::execute(), IClearFunction::execute(), Ldexp_diFunction::execute(), Processes::SetNonblockFunction::execute(), Empty_sFunction::execute(), OClearFunction::execute(), Dexp_iFunction::execute(), Processes::Isatty_isFunction::execute(), Getinterval_sFunction::execute(), IFailFunction::execute(), Processes::Isatty_osFunction::execute(), Getinterval_aFunction::execute(), OGoodFunction::execute(), SLIArrayModule::DoubleVector2ArrayFunction::execute(), Abs_iFunction::execute(), Cvx_aFunction::execute(), Cvx_fFunction::execute(), SLIArrayModule::IntVector2ArrayFunction::execute(), Abs_dFunction::execute(), Cvlit_nFunction::execute(), SLIArrayModule::Add_iv_ivFunction::execute(), IEofFunction::execute(), SLIArrayModule::Add_i_ivFunction::execute(), Cvlit_pFunction::execute(), Neg_iFunction::execute(), OEofFunction::execute(), SLIArrayModule::Neg_ivFunction::execute(), Cvlp_pFunction::execute(), Neg_dFunction::execute(), In_AvailFunction::execute(), SLIArrayModule::Sub_iv_ivFunction::execute(), RangeIterator_aFunction::execute(), ReadDoubleFunction::execute(), SLIArrayModule::Mul_iv_ivFunction::execute(), Inv_dFunction::execute(), IteratorSize_iterFunction::execute(), ReadIntFunction::execute(), SLIArrayModule::Mul_i_ivFunction::execute(), EqFunction::execute(), Cvn_sFunction::execute(), SLIArrayModule::Mul_d_ivFunction::execute(), ReadWordFunction::execute(), Cvn_lFunction::execute(), SLIArrayModule::Div_iv_ivFunction::execute(), NeqFunction::execute(), SLIArrayModule::Add_dv_dvFunction::execute(), AndFunction::execute(), SLIArrayModule::Add_d_dvFunction::execute(), SLIArrayModule::Sub_dv_dvFunction::execute(), OrFunction::execute(), SLIArrayModule::Mul_dv_dvFunction::execute(), SLIArrayModule::Mul_d_dvFunction::execute(), And_iiFunction::execute(), Cvi_sFunction::execute(), SLIArrayModule::Div_dv_dvFunction::execute(), Or_iiFunction::execute(), SLIArrayModule::Neg_dvFunction::execute(), SLIArrayModule::Inv_dvFunction::execute(), XorFunction::execute(), SLIArrayModule::Length_dvFunction::execute(), SLIArrayModule::Length_ivFunction::execute(), Not_bFunction::execute(), SLIArrayModule::Get_iv_iFunction::execute(), SLIArrayModule::Get_iv_ivFunction::execute(), Not_iFunction::execute(), Cvd_sFunction::execute(), SLIArrayModule::Get_dv_ivFunction::execute(), Get_sFunction::execute(), Geq_iiFunction::execute(), SLIArrayModule::Get_dv_iFunction::execute(), Put_sFunction::execute(), SLIArrayModule::Put_dv_i_dFunction::execute(), Geq_idFunction::execute(), SLIArrayModule::Put_iv_i_iFunction::execute(), Token_sFunction::execute(), Put_aFunction::execute(), SLIArrayModule::Zeros_ivFunction::execute(), Geq_diFunction::execute(), Token_isFunction::execute(), Put_pFunction::execute(), SLIArrayModule::Zeros_dvFunction::execute(), Symbol_sFunction::execute(), Put_lpFunction::execute(), Geq_ddFunction::execute(), SLIArrayModule::Ones_dvFunction::execute(), SLIArrayModule::Ones_ivFunction::execute(), Search_sFunction::execute(), SetGuardFunction::execute(), Leq_iiFunction::execute(), SLIArrayModule::ArangeFunction::execute(), Search_aFunction::execute(), Leq_idFunction::execute(), MessageFunction::execute(), Leq_diFunction::execute(), SetVerbosityFunction::execute(), SLIArrayModule::Forall_ivFunction::execute(), IrepeatanyFunction::execute(), SLIArrayModule::Forall_dvFunction::execute(), Leq_ddFunction::execute(), SLIArrayModule::Iforall_ivFunction::execute(), Gt_iiFunction::execute(), SLIArrayModule::Iforall_dvFunction::execute(), Gt_ddFunction::execute(), Gt_idFunction::execute(), Gt_diFunction::execute(), Gt_ssFunction::execute(), Lt_iiFunction::execute(), Lt_ddFunction::execute(), Lt_idFunction::execute(), Lt_diFunction::execute(), Lt_ssFunction::execute(), IntegerFunction::execute(), DoubleFunction::execute(), UnitStep_iFunction::execute(), UnitStep_dFunction::execute(), UnitStep_iaFunction::execute(), UnitStep_daFunction::execute(), Round_dFunction::execute(), Floor_dFunction::execute(), Ceil_dFunction::execute(), Max_i_iFunction::execute(), Max_i_dFunction::execute(), Max_d_iFunction::execute(), Max_d_dFunction::execute(), Min_i_iFunction::execute(), Min_i_dFunction::execute(), Min_d_iFunction::execute(), Min_d_dFunction::execute(), nest::Time::ms::fromtoken(), get_double_in_range(), get_long_in_range(), SLIInterpreter::getcurrentname(), getValue(), Parser::operator()(), SLIInterpreter::print_error(), provide_property(), DictionaryStack::push(), setValue(), and SLIInterpreter::stack_backtrace().

void Token::detach ( )
inline

If the contained datum has more than one reference, clone it, so it can be modified.

References Datum::clone(), Datum::numReferences(), p, and Datum::removeReference().

bool Token::empty ( void  ) const
inline
void Token::info ( std::ostream &  out) const

References Datum::info(), p, and type().

void Token::init_by_copy ( const Token &  rhs)
inline

Initialize the token by moving a datum from another token.

This function assumes that the token does not point to a valid datum and that the argument token does point to a valid datum. This function does not change the reference count of the datum.

References Datum::get_ptr(), and p.

void Token::init_by_pointer ( Datum *  rhs)
inline

Initialize the token with a datum pointer.

This function assumes that the token does not point to a valid datum. The function assumes that the datum is new and DOES NOT increases its reference count.

References p.

void Token::init_by_ref ( const Token &  rhs)
inline

Initialize the token with a reference.

This function assumes that the token does not point to a valid datum and that the argument token does point to a valid datum. This function increases the reference count of the argument.

References Datum::addReference(), and p.

void Token::init_move ( Token &  rhs)
inline

Initialize the token by moving a datum from another token.

This function assumes that the token does not point to a valid datum and that the argument token does point to a valid datum. This function does not change the reference count of the datum.

References p.

template<typename DatumType >
bool Token::is_a ( ) const
inline

Check whether Token contains a Datum of a given type.

Returns
true if Token is of type given by template parameter.

References p.

bool Token::matches_as_string ( const Token &  rhs) const

Returns true if token equals rhs as string.

The main purpose of this method is to allow seamless comparison of LiteralDatum and StringDatum tokens.

Referenced by nest::Communicator::communicate().

void Token::move ( Token &  c)
inline
Token::operator bool ( ) const

References getValue< bool >().

Token::operator Datum * ( ) const
Token::operator double ( ) const

References getValue< double >().

Token::operator float ( ) const

References getValue< float >().

Token::operator long ( ) const

References getValue< long >().

Token::operator size_t ( ) const

References getValue< long >().

Token::operator std::string ( ) const
bool Token::operator! ( void  ) const
inline

References p.

bool Token::operator!= ( const Token &  t) const
inline
Datum& Token::operator* ( ) const
inline

References p.

Datum* Token::operator-> ( ) const
inline

References p.

Token& Token::operator= ( const Token &  c_s)
inline
Token& Token::operator= ( Datum *  p_s)
inline

References p, and Datum::removeReference().

bool Token::operator== ( const Token &  t) const
inline

References Datum::equals(), and p.

void Token::pprint ( std::ostream &  out) const
void Token::set_access_flag ( ) const
inline

References accessed_.

void Token::swap ( Token &  c)
inline
const std::type_info& Token::type ( void  ) const
inline

Referenced by info().

bool Token::valid ( void  ) const
inline

References empty().

Friends And Related Function Documentation

friend class Datum
friend
friend class TokenArrayObj
friend

Member Data Documentation

bool Token::accessed_
mutableprivate

Flag for access control.

Is set by getValue() and setValue() via datum().

Referenced by accessed(), clear_access_flag(), datum(), and set_access_flag().

Datum* Token::p
private

The documentation for this class was generated from the following files: