GURLS++  2.0.00
C++ Implementation of GURLS Matlab Toolbox
gurls::OptArray Class Reference

Optarray is an option containing an indexed array of options.

#include <optarray.h>

Inheritance diagram for gurls::OptArray:
Collaboration diagram for gurls::OptArray:

List of all members.

Public Types

typedef std::vector
< GurlsOption * > 
ValueType

Public Member Functions

void clear ()
 Removes all elements from the array.
void erase (unsigned long index, bool deleteMembers=true)
 Removes the option at a specified index.
virtual const std::type_info & getDataID ()
 Returns the identifier of the option type.
OptTypes getType () const
 Returns the option type.
const ValueType & getValue () const
 Returns the array.
virtual bool isA (OptTypes id) const
 Checks if the option has the given type.
void load (const std::string &fileName)
 Deserializes the array from file.
virtual std::ostream & operator<< (std::ostream &os) const
 Writes the array to a stream.
GurlsOptionoperator[] (unsigned long i) const
 Returns a pointer to the i-th option into the array.
 OptArray ()
 Empty constructor, builds an empty array.
 OptArray (const OptArray &other)
 Constructor form an existing OptArray.
void push_back (GurlsOption *opt)
 Adds a new option at the end of the array.
void reserve (unsigned long size)
 Request a change in capacity.
void save (const std::string &fileName) const
 Serializes the array to file.
unsigned long size () const
 Returns the number of options within the array.
 ~OptArray ()
 Destructor.

Static Public Member Functions

static OptArraydynacast (GurlsOption *opt)
 Tries to cast a pointer to a generic option to a pointer to an OptArray.
static const OptArraydynacast (const GurlsOption *opt)
 Tries to cast a pointer to a generic option to a pointer to an OptArray.

Protected Attributes

OptTypes type
 Option type.
ValueType * value
 Options array.

Friends

GURLS_EXPORT std::ostream & operator<< (std::ostream &os, const GurlsOption &opt)
 Writes an option to a stream.
GURLS_EXPORT std::ostream & operator<< (std::ostream &os, const OptArray &opt)
 Writes an OptArray to a stream.

Detailed Description

Definition at line 58 of file optarray.h.


Member Function Documentation

void gurls::OptArray::erase ( unsigned long  index,
bool  deleteMembers = true 
)
Parameters:
indexIndex
deleteMembersIf true deallocates the removed option, if false option will be only detached

Definition at line 37 of file optarray.cpp.

{
    GurlsOption* opt = (*this)[index];

    value->erase(value->begin()+index);

    if(deleteMembers)
        delete opt;
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends