E
e2point
i need to create a storage module which can store any thing the user
wants. I want it to handle almost any storage requirement, so that
clients can define their own key classes derived from the base key
class which is defined by the storage module itself.
for example:
in the storage module we have
class base_key
{
public:
bool operator < (const base_key& rhs) const = 0;
}
class storage
{
public:
void store(base_key& key, void* data);
void* withdraw(base_key& key);
}
and in the client code,
class my_key : public base_key
{
public:
bool operator < (const base_key& rhs) const
{
...
}
}
i know the above code does not work. I managed to do allow that
functionality somehow by
using lot of workarounds for lot of problems, and that code works
well, but im not sure whether it is the
best method to do this. Im wondering whether there are any standard
methods to provide this kind of functionality, so i can compare my
implementation with it.
thanks.
wants. I want it to handle almost any storage requirement, so that
clients can define their own key classes derived from the base key
class which is defined by the storage module itself.
for example:
in the storage module we have
class base_key
{
public:
bool operator < (const base_key& rhs) const = 0;
}
class storage
{
public:
void store(base_key& key, void* data);
void* withdraw(base_key& key);
}
and in the client code,
class my_key : public base_key
{
public:
bool operator < (const base_key& rhs) const
{
...
}
}
i know the above code does not work. I managed to do allow that
functionality somehow by
using lot of workarounds for lot of problems, and that code works
well, but im not sure whether it is the
best method to do this. Im wondering whether there are any standard
methods to provide this kind of functionality, so i can compare my
implementation with it.
thanks.