#include <typelib/typemodel.hh>
Public Types | |
typedef std::vector< size_t > | MarshalOps |
typedef Container const &(* | ContainerFactory )(Registry &r, std::list< Type const * > const &base_type) |
typedef std::map< std::string, ContainerFactory > | AvailableContainers |
Public Member Functions | |
Container (std::string const &kind, std::string const &name, size_t size, Type const &of) | |
std::string | kind () const |
virtual void | init (void *ptr) const =0 |
virtual void | destroy (void *ptr) const =0 |
virtual bool | visit (void *ptr, ValueVisitor &visitor) const =0 |
virtual void | insert (void *ptr, Value v) const =0 |
virtual bool | erase (void *ptr, Value v) const =0 |
virtual bool | compare (void *ptr, void *other) const =0 |
virtual void | copy (void *dst, void *src) const =0 |
template<typename Pred> | |
void | delete_if (void *ptr, Pred pred) const |
virtual size_t | getElementCount (void *ptr) const =0 |
virtual MarshalOps::const_iterator | dump (void *container_ptr, size_t element_count, std::vector< uint8_t > &buffer, MarshalOps::const_iterator const begin, MarshalOps::const_iterator const end) const =0 |
virtual boost::tuple< size_t, MarshalOps::const_iterator > | load (void *container_ptr, size_t element_count, std::vector< uint8_t > const &buffer, size_t in_offset, MarshalOps::const_iterator const begin, MarshalOps::const_iterator const end) const =0 |
Static Public Member Functions | |
static AvailableContainers | availableContainers () |
static void | registerContainer (std::string const &name, ContainerFactory factory) |
static Container const & | createContainer (Registry &r, std::string const &name, Type const &on) |
static Container const & | createContainer (Registry &r, std::string const &name, std::list< Type const * > const &on) |
Protected Member Functions | |
virtual void | delete_if_impl (void *ptr, DeleteIfPredicate &pred) const =0 |
virtual bool | do_isSame (Type const &other, RecursionStack &stack) const |
virtual ContainerFactory | getFactory () const =0 |
Type * | do_merge (Registry ®istry, RecursionStack &stack) const |
Classes | |
struct | DeleteIfPredicate |
struct | PredicateWrapper |
typedef std::vector<size_t> Typelib::Container::MarshalOps |
typedef Container const&(* Typelib::Container::ContainerFactory)(Registry &r, std::list< Type const * > const &base_type) |
typedef std::map<std::string, ContainerFactory> Typelib::Container::AvailableContainers |
Typelib::Container::Container | ( | std::string const & | kind, | |
std::string const & | name, | |||
size_t | size, | |||
Type const & | of | |||
) |
virtual void Typelib::Container::delete_if_impl | ( | void * | ptr, | |
DeleteIfPredicate & | pred | |||
) | const [protected, pure virtual] |
Referenced by delete_if().
std::string Typelib::Container::kind | ( | ) | const |
virtual void Typelib::Container::init | ( | void * | ptr | ) | const [pure virtual] |
Referenced by Typelib::ValueOps::init(), and Typelib::ValueOps::load().
virtual void Typelib::Container::destroy | ( | void * | ptr | ) | const [pure virtual] |
Referenced by Typelib::ValueOps::destroy().
virtual bool Typelib::Container::visit | ( | void * | ptr, | |
ValueVisitor & | visitor | |||
) | const [pure virtual] |
Referenced by Typelib::ValueVisitor::visit_().
virtual void Typelib::Container::insert | ( | void * | ptr, | |
Value | v | |||
) | const [pure virtual] |
Insert the given element v
into the container at +ptr+
virtual bool Typelib::Container::erase | ( | void * | ptr, | |
Value | v | |||
) | const [pure virtual] |
Removes the element equal to in
ptr
.
has
been found in ptr
, false otherwise. virtual bool Typelib::Container::compare | ( | void * | ptr, | |
void * | other | |||
) | const [pure virtual] |
Called to check if +ptr+ and +other+, which are containers of the same type, actually contain the same data
Referenced by Typelib::ValueOps::compare().
virtual void Typelib::Container::copy | ( | void * | dst, | |
void * | src | |||
) | const [pure virtual] |
Called to copy the contents of +src+ into +dst+, which are both containers of the same type.
Referenced by Typelib::ValueOps::copy().
void Typelib::Container::delete_if | ( | void * | ptr, | |
Pred | pred | |||
) | const [inline] |
References delete_if_impl().
virtual size_t Typelib::Container::getElementCount | ( | void * | ptr | ) | const [pure virtual] |
Referenced by Typelib::ValueOps::dump().
virtual MarshalOps::const_iterator Typelib::Container::dump | ( | void * | container_ptr, | |
size_t | element_count, | |||
std::vector< uint8_t > & | buffer, | |||
MarshalOps::const_iterator const | begin, | |||
MarshalOps::const_iterator const | end | |||
) | const [pure virtual] |
The marshalling process calls this method so that the contents of the container are dumped into the provided buffer.
In the marshalled stream, all containers are dumped as <element-count [65 bits]> <elements>
Referenced by Typelib::ValueOps::dump().
virtual boost::tuple<size_t, MarshalOps::const_iterator> Typelib::Container::load | ( | void * | container_ptr, | |
size_t | element_count, | |||
std::vector< uint8_t > const & | buffer, | |||
size_t | in_offset, | |||
MarshalOps::const_iterator const | begin, | |||
MarshalOps::const_iterator const | end | |||
) | const [pure virtual] |
The marshalling process calls this method so that the contents of the container are loaded from the provided buffer.
In the marshalled stream, all containers are dumped as <element-count [65 bits]> <elements>
buffer
of the first element of the container in_offset
Referenced by Typelib::ValueOps::load().
Container::AvailableContainers Typelib::Container::availableContainers | ( | ) | [static] |
void Typelib::Container::registerContainer | ( | std::string const & | name, | |
ContainerFactory | factory | |||
) | [static] |
Container const & Typelib::Container::createContainer | ( | Registry & | r, | |
std::string const & | name, | |||
Type const & | on | |||
) | [static] |
Container const & Typelib::Container::createContainer | ( | Registry & | r, | |
std::string const & | name, | |||
std::list< Type const * > const & | on | |||
) | [static] |
bool Typelib::Container::do_isSame | ( | Type const & | other, | |
RecursionStack & | stack | |||
) | const [protected, virtual] |
Reimplemented from Typelib::Indirect.
References Typelib::Indirect::do_isSame(), Typelib::Type::do_isSame(), and getFactory().
virtual ContainerFactory Typelib::Container::getFactory | ( | ) | const [protected, pure virtual] |
Referenced by do_isSame(), and do_merge().
Type * Typelib::Container::do_merge | ( | Registry & | registry, | |
RecursionStack & | stack | |||
) | const [protected] |
References getFactory(), Typelib::Indirect::getIndirection(), and Typelib::Type::merge().