Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
Vector Class Reference

#include <containers.hh>

Inheritance diagram for Vector:
Inheritance graph
[legend]

List of all members.

Public Member Functions

void clear (void *) const
bool compare (void *ptr, void *other) const
void copy (void *dst, void *src) const
void delete_if_impl (void *ptr, DeleteIfPredicate &pred) const
void destroy (void *ptr) const
MarshalOps::const_iterator dump (void const *container_ptr, size_t element_count, Typelib::OutputStream &stream, MarshalOps::const_iterator const begin, MarshalOps::const_iterator const end) const
bool erase (void *ptr, Typelib::Value v) const
Typelib::Value getElement (void *ptr, int idx) const
size_t getElementCount (void const *ptr) const
ContainerFactory getFactory () const
long getNaturalSize () const
void init (void *ptr) const
bool isRandomAccess () const
MarshalOps::const_iterator load (void *container_ptr, size_t element_count, Typelib::InputStream &stream, MarshalOps::const_iterator const begin, MarshalOps::const_iterator const end) const
void push (void *ptr, Typelib::Value v) const
void setElement (void *ptr, int idx, Typelib::Value value) const
 Vector (Typelib::Type const &on)
bool visit (void *ptr, Typelib::ValueVisitor &visitor) const

Static Public Member Functions

static Container const & factory (Typelib::Registry &registry, std::list< Typelib::Type const * > const &on)
static std::string fullName (std::string const &element_name)

Private Member Functions

void copy (std::vector< uint8_t > *dst_ptr, size_t dst_idx, std::vector< uint8_t > *src_ptr, size_t src_idx, size_t count) const
void erase (std::vector< uint8_t > *ptr, size_t idx) const
std::string getIndirectTypeName (std::string const &element_name) const
void resize (std::vector< uint8_t > *ptr, size_t new_size) const

Private Attributes

bool is_memcpy

Detailed Description

Definition at line 6 of file containers.hh.


Constructor & Destructor Documentation

Vector::Vector ( Typelib::Type const &  on)

Definition at line 20 of file containers.cc.


Member Function Documentation

void Vector::clear ( void *  ptr) const [virtual]

Removes all elements from this container

Implements Typelib::Container.

Definition at line 51 of file containers.cc.

bool Vector::compare ( void *  ptr,
void *  other 
) const [virtual]

Called to check if +ptr+ and +other+, which are containers of the same type, actually contain the same data

Returns:
true if the two containers have the same data, false otherwise

Implements Typelib::Container.

Definition at line 171 of file containers.cc.

void Vector::copy ( std::vector< uint8_t > *  dst_ptr,
size_t  dst_idx,
std::vector< uint8_t > *  src_ptr,
size_t  src_idx,
size_t  count 
) const [private]

Definition at line 208 of file containers.cc.

void Vector::copy ( void *  dst,
void *  src 
) const [virtual]

Called to copy the contents of +src+ into +dst+, which are both containers of the same type.

Implements Typelib::Container.

Definition at line 196 of file containers.cc.

void Vector::delete_if_impl ( void *  ptr,
DeleteIfPredicate pred 
) const [virtual]

Implements Typelib::Container.

Definition at line 248 of file containers.cc.

void Vector::destroy ( void *  ptr) const [virtual]

Implements Typelib::Container.

Definition at line 44 of file containers.cc.

Container::MarshalOps::const_iterator Vector::dump ( void const *  container_ptr,
size_t  element_count,
Typelib::OutputStream stream,
MarshalOps::const_iterator const  begin,
MarshalOps::const_iterator const  end 
) const [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>

  • container_ptr the pointer to the container data
  • element_count the count of elements in the container. This is passed here to avoid costly computations: getElementCount is already called by the marshalling code itself.
  • stream the stream that will be used to dump the data
  • begin the marshalling code that describes the marshalling process for one element
  • end end of the marshalling code that describes the marshalling process for one element
    Returns:
    the marshalling process should end at the first FLAG_END found in [begin, end) (with nesting taken into account). The returned value is the iterator on this FLAG_END element (i.e. *retval == FLAG_END is a postcondition of this method)

Implements Typelib::Container.

Definition at line 272 of file containers.cc.

void Vector::erase ( std::vector< uint8_t > *  ptr,
size_t  idx 
) const [private]

Definition at line 160 of file containers.cc.

bool Vector::erase ( void *  ptr,
Typelib::Value  v 
) const [virtual]

Removes the element equal to in ptr.

Returns:
true if has been found in ptr, false otherwise.

Implements Typelib::Container.

Definition at line 134 of file containers.cc.

Container const & Vector::factory ( Typelib::Registry registry,
std::list< Typelib::Type const * > const &  on 
) [static]

Definition at line 339 of file containers.cc.

string Vector::fullName ( std::string const &  element_name) [static]

Definition at line 17 of file containers.cc.

Typelib::Value Vector::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 from Typelib::Container.

Definition at line 69 of file containers.cc.

size_t Vector::getElementCount ( void const *  ptr) const [virtual]

Implements Typelib::Container.

Definition at line 35 of file containers.cc.

Container::ContainerFactory Vector::getFactory ( ) const [virtual]

Implements Typelib::Container.

Definition at line 355 of file containers.cc.

std::string Vector::getIndirectTypeName ( std::string const &  inside_name) const [private, virtual]

Overloaded in subclasses to return the name of this type based on the name of the indirection

This is solely used by modifiedDependencyAliases() to update the set of aliases for a given type

Implements Typelib::Indirect.

Definition at line 334 of file containers.cc.

long Vector::getNaturalSize ( ) const [virtual]

Called to return the natural size of the container, i.e. the size it has on this particular machine. This can be different than getSize() in case of registries generated on other machines.

Implements Typelib::Container.

Definition at line 76 of file containers.cc.

void Vector::init ( void *  ptr) const [virtual]

Implements Typelib::Container.

Definition at line 40 of file containers.cc.

bool Vector::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 from Typelib::Container.

Definition at line 58 of file containers.cc.

Container::MarshalOps::const_iterator Vector::load ( void *  container_ptr,
size_t  element_count,
Typelib::InputStream stream,
MarshalOps::const_iterator const  begin,
MarshalOps::const_iterator const  end 
) const [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>

  • container_ptr the pointer to the container data
  • element_count the count of elements in the container, loaded from the stream.
  • stream the stream from which the data will be read
  • in_offset the offset in buffer of the first element of the container
  • begin the marshalling code that describes the loading process for one element
  • end end of the marshalling code that describes the loading process for one element
    Returns:
    the marshalling process should end at the first FLAG_END found in [begin, end) (with nesting taken into account). The first element of the returned value is the iterator on this FLAG_END element (i.e. *retval == FLAG_END is a postcondition of this method). The second element is the new value of in_offset

Implements Typelib::Container.

Definition at line 301 of file containers.cc.

void Vector::push ( void *  ptr,
Typelib::Value  v 
) const [virtual]

Pushes the given element v into the container at +ptr+

Implements Typelib::Container.

Definition at line 119 of file containers.cc.

void Vector::resize ( std::vector< uint8_t > *  ptr,
size_t  new_size 
) const [private]

Definition at line 81 of file containers.cc.

void Vector::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 from Typelib::Container.

Definition at line 60 of file containers.cc.

bool Vector::visit ( void *  ptr,
Typelib::ValueVisitor visitor 
) const [virtual]

Implements Typelib::Container.

Definition at line 233 of file containers.cc.


Member Data Documentation

bool Vector::is_memcpy [private]

Definition at line 8 of file containers.hh.


The documentation for this class was generated from the following files:


typelib
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Thu Jan 2 2014 11:38:41