43 using namespace Constants;
121 struct symbol_t::symbol_data
132 data =
new symbol_data;
156 if (data->count == 0)
169 if (data->count == 0)
184 return data == symbol.data;
190 return data != symbol.data;
195 return data < symbol.data;
251 struct frame_t::frame_data
256 vector<symbol_t> symbols;
257 map<string, int32_t> mapping;
267 data = (frame_data*)p;
290 if (data->count == 0)
302 if (data->count == 0)
318 return data == frame.data;
324 return data != frame.data;
330 return data->symbols.size();
336 return data->symbols[n];
342 return data->symbols[n];
348 return data->symbols[n];
355 data->symbols.push_back(symbol);
358 data->mapping[symbol.
getName()] = data->symbols.size() - 1;
369 data->symbols.push_back(symbol);
372 data->mapping[symbol.
getName()] = data->symbols.size() - 1;
382 for (uint32_t i = 0; i < frame.
getSize(); i++)
394 for (uint32_t i = 0; i < data->symbols.size(); i++)
398 symbol.data->frame = frame.data;
400 data->symbols.clear();
401 data->mapping.clear();
407 vector<symbol_t> symbols = data->symbols;
408 data->symbols.clear();
409 data->mapping.clear();
410 for (uint32_t i = 0; i < symbols.size(); i++)
416 symbol.data->frame = data;
423 map<string, int32_t>::const_iterator i = data->mapping.find(name);
424 return (i == data->mapping.end() ? -1 : i->second);
430 vector<symbol_t>::const_iterator first = data->symbols.begin();
431 vector<symbol_t>::const_iterator last = data->symbols.end();
432 for( ; first != last; ++first, ++index)
434 if (*first == symbol)
448 int32_t idx = getIndexOf(name);
451 return (data->hasParent ? getParent().resolve(name, symbol) :
false);
453 symbol = data->symbols[idx];
460 if (!data->hasParent)
470 return data->hasParent;
476 frame_data *data =
new frame_data;
486 frame_data *data =
new frame_data;
489 data->parent = parent.data;
496 for(uint32_t i = 0; i < t.
getSize(); ++i)
symbol_t getSymbol(int32_t)
Returns the Nth symbol in this frame.
bool resolve(const std::string &name, symbol_t &symbol)
Resolves a name in this frame or a parent frame.
range_t operator|(const range_t &) const
Constructs the union of two ranges.
bool operator==(const range_t &) const
Equallity operator.
bool hasParent() const
Returns true if this frame has a parent.
range_t intersect(const range_t &) const
Constructs the intersection of two ranges.
uint32_t getSize() const
Returns the number of symbols in this frame.
std::string getName() const
Returns the name (identifier) of this symbol.
bool operator!=(const frame_t &) const
Inequality operator.
bool operator!=(const range_t &) const
Inequallity operator.
bool operator==(const frame_t &) const
Equality operator.
bool contains(const range_t &) const
Returns true if the argument is contained in the range.
void remove(symbol_t s)
removes the given symbol
std::ostream & operator<<(std::ostream &os, const SignalFlow::strs_t &s)
static frame_t createFrame()
Creates and returns a new root-frame.
const frame_t & operator=(const frame_t &)
Assignment operator.
bool operator==(const symbol_t &) const
Equality operator.
bool isEmpty() const
Returns true if and only if the range is empty.
symbol_t()
Default constructor.
range_t operator &(const range_t &) const
Constructs the intersection of two ranges.
static string symbol(const char *str)
Extracts the alpha-numerical symbol used for variable/type identifiers.
frame_t getParent()
Returns the parent frame.
void setName(const std::string &)
Alters the name of this symbol.
const symbol_t & operator=(const symbol_t &)
Assignment operator.
type_t getType() const
Returns the type of this symbol.
void setType(type_t)
Alters the type of this symbol.
range_t()
Constructs the empty range.
symbol_t operator[](int32_t)
Returns the Nth symbol in this frame.
void * getData()
Returns the user data of this symbol.
void setData(void *)
Sets the user data of this symbol.
bool operator<(const symbol_t &) const
Less-than operator.
void moveTo(frame_t)
Move all symbols from this to a given one (leaving this empty).
range_t join(const range_t &) const
Constructs the union of two ranges.
symbol_t addSymbol(const std::string &name, type_t, void *user=NULL)
Adds a symbol of the given name and type to the frame.
frame_t getFrame()
Get frame this symbol belongs to.
frame_t()
Default constructor.
int32_t getIndexOf(const std::string &name) const
Returns the index of the symbol with the given name.
void add(symbol_t)
Add all symbols from the given frame.
bool operator!=(const symbol_t &) const
Inequality operator.