Well, I am using a Map to store any kind of pointer (void*), and it is being used in a scope object. here is the scope class.
class Scope
{
protected:
Scope * parent;
MyMap* map;
public:
virtual void setParent(Scope* p)=0;
virtual Scope* getParent()=0;
virtual void setOwner(void * owner)=0;
virtual void * getOwner()=0;
virtual Symbol * get(char* name)=0;
virtual Symbol * get(char* name, Signature * sig)=0;
MyMap* getMap()const;
};
and there are 2 classes OrderedScope
and DisorderedScope
which implement the Scope
class.
In my project I'm trying to store all data as void* and then I retrieve them and cast them to the apropriate type. when I cast an object on its type, I found that some data was lost. here is a photo of what I got.
just to clarify Package
class has Scope. And in that scope I am storing objects of type Function
s. So when I want to add a function to it I should retrieve the package object first then I can use the add
function to insert the new function.
I don't know if I showed the problem correctly, but I hope so. your help is appreciated.