te::dt::CompositeProperty Class Reference

A base class for a compound property (non-atomic properties). More...

#include <CompositeProperty.h>

Inheritance diagram for te::dt::CompositeProperty:
te::dt::Property te::da::DataSetType te::graph::EdgeProperty te::graph::VertexProperty

Public Member Functions

void add (Property *p)
 It adds a new property to the CompositeProperty. More...
 
void add (const std::vector< Property *> &ps)
 It adds a list of property types to the CompositeProperty. More...
 
void add (const boost::ptr_vector< te::dt::Property > &ps)
 
virtual void clear ()
 It clears the CompositeProperty definition. More...
 
virtual Propertyclone () const
 It returns a clone of the object. More...
 
 CompositeProperty (const std::string &cname, const std::string &name, unsigned int id=0, Property *parent=0)
 It creates a new CompositeProperty. More...
 
 CompositeProperty (const CompositeProperty &rhs)
 Copy constructor. More...
 
void copy (const std::vector< Property *> &ps)
 It copies the properties from the vector. More...
 
PropertyfindFirstPropertyOfType (const int t) const
 returns the first property of the given data type. Caller doesn't take ownership of the returned pointer. More...
 
const std::string & getCompositeName () const
 It returns the name of the composite type. More...
 
const std::string & getDatasetName () const
 It returns the name of the propery's dataset. More...
 
unsigned int getId () const
 It returns the property identifier. More...
 
const std::string & getName () const
 It returns the property name. More...
 
PropertygetParent () const
 It returns the parent of this property, or NULL, if it doesn't have one. More...
 
const std::vector< Property * > & getProperties () const
 It returns the list of properties describing the CompositeProperty. More...
 
std::vector< Property * > & getProperties ()
 It returns the list of properties describing the CompositeProperty. More...
 
PropertygetProperty (std::size_t i) const
 It returns the i-th property. More...
 
PropertygetProperty (const std::string &name) const
 It returns the property with the given name or NULL if none is found. More...
 
PropertygetPropertyById (unsigned int id) const
 It searches for a property with the given ID. More...
 
std::size_t getPropertyPosition (const std::string &name) const
 It returns the property position based on its name. More...
 
std::size_t getPropertyPosition (const Property *p) const
 It returns the property position . More...
 
int getType () const
 It returns the property data type. More...
 
bool has (Property *p) const
 It checks if the Property "p" is associated to this property or any other parent. More...
 
bool hasPropertyOfType (const int t) const
 Tells if there is a property of the given data type. More...
 
CompositePropertyoperator= (const CompositeProperty &rhs)
 Assignment operator. More...
 
virtual void remove (Property *p)
 It removes the property from the composite. More...
 
void setCompositeName (const std::string &cname)
 It sets the composite type name. More...
 
void setDatasetName (const std::string &dsName)
 It sets the property name. More...
 
void setId (unsigned int id)
 It sets the property identifier. More...
 
void setName (const std::string &name)
 It sets the property name. More...
 
void setParent (Property *p)
 It associate this property to the informed parent. More...
 
std::size_t size () const
 It returns the number of properties of the CompositeProperty. More...
 
virtual ~CompositeProperty ()
 Virtual destructor. More...
 

Protected Member Functions

 CompositeProperty (const std::string &cname, const std::string &name, int t, unsigned int id, Property *parent)
 It creates a new Property. More...
 

Protected Attributes

std::string m_cname
 The composite type name. More...
 
std::string m_datasetName
 The property's dataset name. More...
 
unsigned int m_id
 An identification number that can be used internally. More...
 
std::string m_name
 The property name. More...
 
Propertym_parent
 The parent property type: it must be a CompositeProperty. More...
 
std::vector< Property * > m_properties
 The list of property types that make the CompositeProperty. More...
 
int m_type
 The property data type. More...
 

Detailed Description

A base class for a compound property (non-atomic properties).

See also
Property, SimpleProperty, NumericProperty, StringProperty, ArrayProperty, DateTimeProperty

Definition at line 51 of file CompositeProperty.h.

Constructor & Destructor Documentation

◆ CompositeProperty() [1/3]

te::dt::CompositeProperty::CompositeProperty ( const std::string &  cname,
const std::string &  name,
unsigned int  id = 0,
Property parent = 0 
)

It creates a new CompositeProperty.

Parameters
cnameThe composite type name.
nameThe property name.
idThe property identifier.
parentA reference to the parent Property of the new object if it has one.
Warning
The identifier value (id) may be used by data source implementations. So, don't rely on its value!

◆ CompositeProperty() [2/3]

te::dt::CompositeProperty::CompositeProperty ( const CompositeProperty rhs)

Copy constructor.

Parameters
rhsThe right-hand-side copy used to copy from.

◆ ~CompositeProperty()

virtual te::dt::CompositeProperty::~CompositeProperty ( )
virtual

Virtual destructor.

◆ CompositeProperty() [3/3]

te::dt::CompositeProperty::CompositeProperty ( const std::string &  cname,
const std::string &  name,
int  t,
unsigned int  id,
Property parent 
)
protected

It creates a new Property.

Parameters
cnameThe composite type name.
nameThe Property name.
tThe data type id.
idThe property identifier.
parentA reference to the parent Property of the new object if it has one.

Member Function Documentation

◆ add() [1/3]

void te::dt::CompositeProperty::add ( Property p)

It adds a new property to the CompositeProperty.

Parameters
pThe property to be inserted.
Precondition
The Property p must be valid.
The Property p must not be associated to another property.
Postcondition
The property p will be associated to CompositeProperty.
The CompositeProperty takes the ownership of the property.

◆ add() [2/3]

void te::dt::CompositeProperty::add ( const std::vector< Property *> &  ps)

It adds a list of property types to the CompositeProperty.

Parameters
psThe list of properties to be added.
Precondition
The properties must be valid.
The properties must not be associated to another property.
Note
The CompositeProperty takes the ownership of the properties.

◆ add() [3/3]

void te::dt::CompositeProperty::add ( const boost::ptr_vector< te::dt::Property > &  ps)

◆ clear()

virtual void te::dt::CompositeProperty::clear ( )
virtual

It clears the CompositeProperty definition.

Reimplemented in te::da::DataSetType.

◆ clone()

virtual Property* te::dt::CompositeProperty::clone ( ) const
virtual

It returns a clone of the object.

The new property will NOT have associations to other elements.

Returns
A clone of the object.

Implements te::dt::Property.

Reimplemented in te::da::DataSetType.

◆ copy()

void te::dt::CompositeProperty::copy ( const std::vector< Property *> &  ps)

It copies the properties from the vector.

Parameters
psThe list of properties to be copied.
Note
The CompositeProperty will not take the ownership of the properties, it will clone each one. So, it is the caller responsability to release them.

◆ findFirstPropertyOfType()

Property * te::dt::CompositeProperty::findFirstPropertyOfType ( const int  t) const
inline

returns the first property of the given data type. Caller doesn't take ownership of the returned pointer.

Definition at line 278 of file CompositeProperty.h.

References te::dt::Property::getType(), m_properties, and size().

Referenced by hasPropertyOfType().

◆ getCompositeName()

const std::string& te::dt::CompositeProperty::getCompositeName ( ) const
inline

It returns the name of the composite type.

Returns
The name of the composite type.
Note
This name may be different from the property name (returned by getName method)!

Definition at line 96 of file CompositeProperty.h.

◆ getDatasetName()

const std::string& te::dt::Property::getDatasetName ( ) const
inlineinherited

It returns the name of the propery's dataset.

Returns
The the propery's dataset name.

Definition at line 144 of file Property.h.

◆ getId()

unsigned int te::dt::Property::getId ( ) const
inlineinherited

It returns the property identifier.

Returns
A number used to identify the property.
Warning
The identifier value may be used by data source implementations. So, don't rely on its value!

Definition at line 109 of file Property.h.

◆ getName()

const std::string& te::dt::Property::getName ( ) const
inlineinherited

It returns the property name.

Returns
The property name.
Note
For DataSetTypes the name can have namespace prefix or schema name prefix, it will depend on the data source implementation.

Definition at line 127 of file Property.h.

◆ getParent()

Property* te::dt::Property::getParent ( ) const
inlineinherited

It returns the parent of this property, or NULL, if it doesn't have one.

Returns
The parent of this property, or NULL, if it doesn't have one.

Definition at line 168 of file Property.h.

◆ getProperties() [1/2]

const std::vector<Property*>& te::dt::CompositeProperty::getProperties ( ) const
inline

It returns the list of properties describing the CompositeProperty.

Returns
The list of Propertys describing the CompositeProperty.

Definition at line 153 of file CompositeProperty.h.

◆ getProperties() [2/2]

std::vector<Property*>& te::dt::CompositeProperty::getProperties ( )
inline

It returns the list of properties describing the CompositeProperty.

Returns
The list of Propertys describing the CompositeProperty.

Definition at line 160 of file CompositeProperty.h.

◆ getProperty() [1/2]

Property* te::dt::CompositeProperty::getProperty ( std::size_t  i) const
inline

It returns the i-th property.

Parameters
iThe property position in the property array.
Returns
A pointer to the i-th property. Don't delete it, as it belongs to the CompositeProperty.
Precondition
i must be in the valid range [0, size()).

Definition at line 171 of file CompositeProperty.h.

◆ getProperty() [2/2]

Property* te::dt::CompositeProperty::getProperty ( const std::string &  name) const

It returns the property with the given name or NULL if none is found.

Parameters
nameThe name of the property we are looking for.
Returns
A pointer to a property or NULL if none is found. Don't delete it, as it belongs to the CompositeProperty.

◆ getPropertyById()

Property* te::dt::CompositeProperty::getPropertyById ( unsigned int  id) const

It searches for a property with the given ID.

Parameters
idThe property ID.
Returns
A pointer to the first property with the given ID if found or NULL otherwise. Don't delete it, as it belongs to the CompositeProperty.

◆ getPropertyPosition() [1/2]

std::size_t te::dt::CompositeProperty::getPropertyPosition ( const std::string &  name) const

It returns the property position based on its name.

Parameters
nameThe property name.
Returns
A property position in the property array.

◆ getPropertyPosition() [2/2]

std::size_t te::dt::CompositeProperty::getPropertyPosition ( const Property p) const

It returns the property position .

Parameters
pThe property.
Returns
A property position in the property array.

◆ getType()

int te::dt::Property::getType ( ) const
inlineinherited

It returns the property data type.

Returns
The property data type.

Definition at line 161 of file Property.h.

Referenced by findFirstPropertyOfType().

◆ has()

bool te::dt::CompositeProperty::has ( Property p) const
virtual

It checks if the Property "p" is associated to this property or any other parent.

Parameters
pThe Property we are checking.
Returns
True if the given Property "p" is associated to to this Property, otherwise, returns false.

Implements te::dt::Property.

◆ hasPropertyOfType()

bool te::dt::CompositeProperty::hasPropertyOfType ( const int  t) const
inline

Tells if there is a property of the given data type.

Definition at line 273 of file CompositeProperty.h.

References findFirstPropertyOfType().

Referenced by te::da::DataSetType::hasRaster().

◆ operator=()

CompositeProperty& te::dt::CompositeProperty::operator= ( const CompositeProperty rhs)

Assignment operator.

Parameters
rhsThe right-hand-side copy used to copy from.
Returns
A reference to this object.

◆ remove()

virtual void te::dt::CompositeProperty::remove ( Property p)
virtual

It removes the property from the composite.

Parameters
pThe property to be removed from the composite.
Postcondition
The property pointer will be invalidated.

◆ setCompositeName()

void te::dt::CompositeProperty::setCompositeName ( const std::string &  cname)
inline

It sets the composite type name.

Parameters
nameThe composite type name.

Definition at line 103 of file CompositeProperty.h.

◆ setDatasetName()

void te::dt::Property::setDatasetName ( const std::string &  dsName)
inlineinherited

It sets the property name.

Parameters
nameThe new property name.
Warning
Take care when calling this method for a DataSetType associated to a DataSourceCatalog. Prefer using the rename method on the DataSourceCatalog API instead of using this method.

Definition at line 154 of file Property.h.

◆ setId()

void te::dt::Property::setId ( unsigned int  id)
inlineinherited

It sets the property identifier.

Parameters
idA number used to identify the property.
Warning
The identifier value may be used by data source implementations. So, don't rely on its value!

Definition at line 118 of file Property.h.

◆ setName()

void te::dt::Property::setName ( const std::string &  name)
inlineinherited

It sets the property name.

Parameters
nameThe new property name.
Warning
Take care when calling this method for a DataSetType associated to a DataSourceCatalog. Prefer using the rename method on the DataSourceCatalog API instead of using this method.

Definition at line 137 of file Property.h.

◆ setParent()

void te::dt::Property::setParent ( Property p)
inlineinherited

It associate this property to the informed parent.

Parameters
pTeh parent property.
Warning
Don't use this method without knowing the internal details of its use.

Definition at line 177 of file Property.h.

◆ size()

std::size_t te::dt::CompositeProperty::size ( ) const
inline

It returns the number of properties of the CompositeProperty.

Returns
The number of properties of the CompositeProperty.

Definition at line 146 of file CompositeProperty.h.

Referenced by findFirstPropertyOfType().

Member Data Documentation

◆ m_cname

std::string te::dt::CompositeProperty::m_cname
protected

The composite type name.

Definition at line 269 of file CompositeProperty.h.

◆ m_datasetName

std::string te::dt::Property::m_datasetName
protectedinherited

The property's dataset name.

Definition at line 208 of file Property.h.

◆ m_id

unsigned int te::dt::Property::m_id
protectedinherited

An identification number that can be used internally.

Definition at line 205 of file Property.h.

◆ m_name

std::string te::dt::Property::m_name
protectedinherited

The property name.

Definition at line 207 of file Property.h.

◆ m_parent

Property* te::dt::Property::m_parent
protectedinherited

The parent property type: it must be a CompositeProperty.

Definition at line 204 of file Property.h.

◆ m_properties

std::vector<Property*> te::dt::CompositeProperty::m_properties
protected

The list of property types that make the CompositeProperty.

Definition at line 270 of file CompositeProperty.h.

Referenced by findFirstPropertyOfType().

◆ m_type

int te::dt::Property::m_type
protectedinherited

The property data type.

Definition at line 206 of file Property.h.


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