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

#include <dictstack.h>

Public Member Functions

 DictionaryStack (const Token &=Token())
 
 DictionaryStack (const DictionaryStack &)
 
 ~DictionaryStack ()
 
void cache_token (const Name &n, const Token *result)
 Add a token to the cache. More...
 
void basecache_token (const Name &n, const Token *result)
 
void clear_token_from_cache (const Name &n)
 Clear a name from the cache. More...
 
void clear_token_from_basecache (const Name &n)
 
void clear_dict_from_cache (DictionaryDatum d)
 
void clear_cache ()
 Clear the entire cache. More...
 
const Tokenlookup (const Name &n)
 
const Tokenlookup2 (const Name &n)
 
const Tokenbaselookup (const Name &n)
 Lookup a name searching only the bottom level dictionary. More...
 
bool known (const Name &n)
 Test for a name searching all dictionaries on the stack. More...
 
bool baseknown (const Name &n)
 Test for a name in the bottom level dictionary. More...
 
void def (const Name &, const Token &)
 Bind a Token to a Name in the top level dictionary. More...
 
void undef (const Name &)
 Unbind a previously defined Name from its token. More...
 
void basedef (const Name &n, const Token &t)
 Bind a Token to a Name in the bottom level dictionary. More...
 
void def_move (const Name &, Token &)
 Bind a Token to a Name in the top level dictionary. More...
 
void set_basedict ()
 This function must be called once to initialize the systemdict cache. More...
 
void basedef_move (const Name &n, Token &t)
 Bind a Token to a Name in the bottom level dictionary. More...
 
bool where (const Name &, Token &)
 
void pop (void)
 
void top (Token &) const
 
void push (const DictionaryDatum &)
 
void push (Token &)
 
void clear (void)
 
void toArray (TokenArray &) const
 
size_t size (void) const
 
void info (std::ostream &) const
 
void top_info (std::ostream &) const
 
const DictionaryStackoperator= (const DictionaryStack &)
 

Private Attributes

const Token VoidToken
 
std::list< DictionaryDatumd
 
DictionaryDatum base_
 
std::vector< const Token * > cache_
 
std::vector< const Token * > basecache_
 

Constructor & Destructor Documentation

DictionaryStack::DictionaryStack ( const Token t = Token())
DictionaryStack::DictionaryStack ( const DictionaryStack ds)
DictionaryStack::~DictionaryStack ( )

References d.

Member Function Documentation

void DictionaryStack::basecache_token ( const Name n,
const Token result 
)
inline
void DictionaryStack::basedef ( const Name n,
const Token t 
)

Bind a Token to a Name in the bottom level dictionary.

The Token is copied.

References base_, basecache_token(), clear_token_from_cache(), and nest::names::n.

Referenced by SLIInterpreter::basedef().

void DictionaryStack::basedef_move ( const Name n,
Token t 
)

Bind a Token to a Name in the bottom level dictionary.

The Token is moved.

References base_, basecache_token(), and clear_token_from_cache().

Referenced by SLIInterpreter::basedef_move().

bool DictionaryStack::baseknown ( const Name n)
inline

Test for a name in the bottom level dictionary.

References base_, basecache_, basecache_token(), cache_token(), Name::toIndex(), and where().

Referenced by SLIInterpreter::baseknown().

const Token& DictionaryStack::baselookup ( const Name n)
inline

Lookup a name searching only the bottom level dictionary.

If the Name is not found, VoidToken is returned.

References base_, basecache_, basecache_token(), cache_token(), Name::toIndex(), VoidToken, and where().

Referenced by SLIInterpreter::baselookup().

void DictionaryStack::cache_token ( const Name n,
const Token result 
)
inline

Add a token to the cache.

References cache_, Name::num_handles(), and Name::toIndex().

Referenced by baseknown(), baselookup(), def(), def_move(), known(), and lookup2().

void DictionaryStack::clear ( void  )

References clear_cache(), and d.

void DictionaryStack::clear_cache ( )
inline

Clear the entire cache.

This should be called whenever a dictionary is pushed or poped. Alternative, one could just clear the names from the moved dictionary.

References cache_.

Referenced by clear().

void DictionaryStack::clear_dict_from_cache ( DictionaryDatum  d)
inline
void DictionaryStack::clear_token_from_basecache ( const Name n)
inline

References basecache_, and Name::toIndex().

Referenced by undef().

void DictionaryStack::clear_token_from_cache ( const Name n)
inline

Clear a name from the cache.

This function should be called in each def variant.

References cache_, and Name::toIndex().

Referenced by basedef(), basedef_move(), clear_dict_from_cache(), DictputFunction::execute(), UndefFunction::execute(), and undef().

void DictionaryStack::def ( const Name n,
const Token t 
)
inline

Bind a Token to a Name in the top level dictionary.

The Token is copied.

References cache_token(), and d.

Referenced by SLIInterpreter::def().

void DictionaryStack::def_move ( const Name n,
Token t 
)
inline

Bind a Token to a Name in the top level dictionary.

The Token is moved.

References cache_token(), and d.

Referenced by SLIInterpreter::createcommand(), SLIInterpreter::createconstant(), SLIInterpreter::createdouble(), and SLIInterpreter::def_move().

void DictionaryStack::info ( std::ostream &  o) const

References d.

Referenced by WhoFunction::execute(), and top_info().

bool DictionaryStack::known ( const Name n)
inline

Test for a name searching all dictionaries on the stack.

References cache_, cache_token(), d, Name::toIndex(), and where().

Referenced by SLIInterpreter::createcommand(), and SLIInterpreter::known().

const Token& DictionaryStack::lookup ( const Name n)
inline

References lookup2(), and VoidToken.

Referenced by SLIInterpreter::lookup().

const Token& DictionaryStack::lookup2 ( const Name n)
inline
const DictionaryStack & DictionaryStack::operator= ( const DictionaryStack ds)

References cache_, and d.

void DictionaryStack::pop ( void  )
void DictionaryStack::push ( const DictionaryDatum pd)
void DictionaryStack::push ( Token d)

References assert(), Token::datum(), and push().

void DictionaryStack::set_basedict ( )

This function must be called once to initialize the systemdict cache.

References base_, and d.

Referenced by SLIInterpreter::initdictionaries().

size_t DictionaryStack::size ( void  ) const
void DictionaryStack::toArray ( TokenArray ta) const
void DictionaryStack::top ( Token t) const
void DictionaryStack::top_info ( std::ostream &  o) const

References d, and info().

Referenced by DicttopinfoFunction::execute().

void DictionaryStack::undef ( const Name n)

Unbind a previously defined Name from its token.

Seach in all dictionaries.

References clear_token_from_basecache(), clear_token_from_cache(), d, and Name::toString().

Referenced by SLIInterpreter::undef().

bool DictionaryStack::where ( const Name ,
Token  
)

Referenced by baseknown(), baselookup(), known(), and lookup2().

Member Data Documentation

DictionaryDatum DictionaryStack::base_
private
std::vector<const Token *> DictionaryStack::basecache_
private
std::vector<const Token *> DictionaryStack::cache_
private
std::list<DictionaryDatum> DictionaryStack::d
private
const Token DictionaryStack::VoidToken
private

Referenced by baselookup(), and lookup().


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