#include <typemodel.hh>
Classes | |
struct | DeleteIfPredicate |
struct | PredicateWrapper |
Public Types | |
typedef std::map< std::string, ContainerFactory > | AvailableContainers |
typedef Container const &(* | ContainerFactory )(Registry &r, std::list< Type const * > const &base_type) |
typedef std::vector< size_t > | MarshalOps |
Public Member Functions | |
virtual void | clear (void *ptr) const =0 |
virtual bool | compare (void *ptr, void *other) const =0 |
Container (std::string const &kind, std::string const &name, size_t size, Type const &of) | |
virtual void | copy (void *dst, void *src) const =0 |
template<typename Pred > | |
void | delete_if (void *ptr, Pred pred) const |
virtual void | destroy (void *ptr) const =0 |
virtual MarshalOps::const_iterator | dump (void const *container_ptr, size_t element_count, OutputStream &stream, MarshalOps::const_iterator const begin, MarshalOps::const_iterator const end) const =0 |
virtual bool | erase (void *ptr, Value v) const =0 |
virtual Typelib::Value | getElement (void *ptr, int idx) const |
virtual size_t | getElementCount (void const *ptr) const =0 |
virtual long | getNaturalSize () const =0 |
virtual void | init (void *ptr) const =0 |
virtual bool | isRandomAccess () const |
std::string | kind () const |
virtual MarshalOps::const_iterator | load (void *container_ptr, size_t element_count, InputStream &stream, MarshalOps::const_iterator const begin, MarshalOps::const_iterator const end) const =0 |
virtual void | push (void *ptr, Value v) const =0 |
virtual void | setElement (void *ptr, int idx, Typelib::Value value) const |
virtual bool | visit (void *ptr, ValueVisitor &visitor) const =0 |
Static Public Member Functions | |
static const AvailableContainers & | availableContainers () |
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) |
static void | registerContainer (std::string const &name, ContainerFactory factory) |
Protected Member Functions | |
virtual void | delete_if_impl (void *ptr, DeleteIfPredicate &pred) const =0 |
virtual bool | do_compare (Type const &other, bool equality, RecursionStack &stack) const |
Type * | do_merge (Registry ®istry, RecursionStack &stack) const |
virtual ContainerFactory | getFactory () const =0 |
Private Attributes | |
std::string | m_kind |
Static Private Attributes | |
static AvailableContainers | s_available_containers |
Base type for variable-length sets
Definition at line 507 of file typemodel.hh.
typedef std::map<std::string, ContainerFactory> Typelib::Container::AvailableContainers |
Definition at line 658 of file typemodel.hh.
typedef Container const&(* Typelib::Container::ContainerFactory)(Registry &r, std::list< Type const * > const &base_type) |
Definition at line 657 of file typemodel.hh.
typedef std::vector<size_t> Typelib::Container::MarshalOps |
Definition at line 537 of file typemodel.hh.
Typelib::Container::Container | ( | std::string const & | kind, |
std::string const & | name, | ||
size_t | size, | ||
Type const & | of | ||
) |
Definition at line 565 of file typemodel.cc.
const Container::AvailableContainers & Typelib::Container::availableContainers | ( | ) | [static] |
Definition at line 572 of file typemodel.cc.
virtual void Typelib::Container::clear | ( | void * | ptr | ) | const [pure virtual] |
virtual bool Typelib::Container::compare | ( | void * | ptr, |
void * | other | ||
) | const [pure virtual] |
virtual void Typelib::Container::copy | ( | void * | dst, |
void * | src | ||
) | const [pure virtual] |
Container const & Typelib::Container::createContainer | ( | Registry & | r, |
std::string const & | name, | ||
Type const & | on | ||
) | [static] |
Definition at line 580 of file typemodel.cc.
Container const & Typelib::Container::createContainer | ( | Registry & | r, |
std::string const & | name, | ||
std::list< Type const * > const & | on | ||
) | [static] |
Definition at line 586 of file typemodel.cc.
void Typelib::Container::delete_if | ( | void * | ptr, |
Pred | pred | ||
) | const [inline] |
Definition at line 606 of file typemodel.hh.
virtual void Typelib::Container::delete_if_impl | ( | void * | ptr, |
DeleteIfPredicate & | pred | ||
) | const [protected, pure virtual] |
virtual void Typelib::Container::destroy | ( | void * | ptr | ) | const [pure virtual] |
bool Typelib::Container::do_compare | ( | Type const & | other, |
bool | equality, | ||
RecursionStack & | stack | ||
) | const [protected, virtual] |
Reimplemented from Typelib::Indirect.
Definition at line 594 of file typemodel.cc.
Type * Typelib::Container::do_merge | ( | Registry & | registry, |
RecursionStack & | stack | ||
) | const [protected, virtual] |
Called by Type::merge when the type does not exist in registry
already. This method has to create a new type in registry that matches the type definition of *this.
All types referenced by *this must be moved to their equivalent in registry
.
Implements Typelib::Type.
Definition at line 603 of file typemodel.cc.
virtual MarshalOps::const_iterator Typelib::Container::dump | ( | void const * | container_ptr, |
size_t | element_count, | ||
OutputStream & | stream, | ||
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 [64 bits]> <elements>
virtual bool Typelib::Container::erase | ( | void * | ptr, |
Value | v | ||
) | const [pure virtual] |
Typelib::Value Typelib::Container::getElement | ( | void * | ptr, |
int | idx | ||
) | const [virtual] |
On random access containers, allows to access elements by their index
Random access containers are containers for which isRandomAccess() returns true.
Throws std::logic_error on containers that are not random access
Reimplemented in Vector.
Definition at line 618 of file typemodel.cc.
virtual size_t Typelib::Container::getElementCount | ( | void const * | ptr | ) | const [pure virtual] |
virtual ContainerFactory Typelib::Container::getFactory | ( | ) | const [protected, pure virtual] |
virtual long Typelib::Container::getNaturalSize | ( | ) | const [pure virtual] |
virtual void Typelib::Container::init | ( | void * | ptr | ) | const [pure virtual] |
bool Typelib::Container::isRandomAccess | ( | ) | const [virtual] |
If true, this is a random access container and both the getElement(int) and setElement(int) methods can be used
Containers are not random-access by default
Reimplemented in Vector.
Definition at line 615 of file typemodel.cc.
std::string Typelib::Container::kind | ( | ) | const |
Definition at line 569 of file typemodel.cc.
virtual MarshalOps::const_iterator Typelib::Container::load | ( | void * | container_ptr, |
size_t | element_count, | ||
InputStream & | stream, | ||
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 [64 bits]> <elements>
buffer
of the first element of the container in_offset
virtual void Typelib::Container::push | ( | void * | ptr, |
Value | v | ||
) | const [pure virtual] |
void Typelib::Container::registerContainer | ( | std::string const & | name, |
ContainerFactory | factory | ||
) | [static] |
Definition at line 576 of file typemodel.cc.
void Typelib::Container::setElement | ( | void * | ptr, |
int | idx, | ||
Typelib::Value | value | ||
) | const [virtual] |
On random access containers, allows to set an element's value by its index
Random access containers are containers for which isRandomAccess() returns true.
Throws std::logic_error on containers that are not random access
Reimplemented in Vector.
Definition at line 616 of file typemodel.cc.
virtual bool Typelib::Container::visit | ( | void * | ptr, |
ValueVisitor & | visitor | ||
) | const [pure virtual] |
std::string Typelib::Container::m_kind [private] |
Definition at line 509 of file typemodel.hh.
Container::AvailableContainers Typelib::Container::s_available_containers [static, private] |
Definition at line 671 of file typemodel.hh.