pandore::Collection Class Reference

#include <collection.h>

List of all members.


Detailed Description

A collection of Pandore objects.

A Collection is a bundle of heterogeneous data (a la struct C). Each data in a collection is indexed by a name. Available types of data are:


For the use of Collection see The Collection.


Public Member Functions

Typobj Type () const
std::string Name () const
Pobject * Clone () const
Collectionoperator= (const Collection &col)
void Erase (const std::string &name)
void Delete ()
void Rename (const std::string &oldname, const std::string &newname)
bool Exists (const std::string &name) const
Errc NbOf (const std::string &name, std::string &type_out, Long &number_out, Long &minsize_out) const
std::string GetType (const std::string &name) const
std::list< std::string > List () const
Errc LoadAttributes (FILE *)
Errc SaveAttributes (FILE *file) const
Errc LoadData (FILE *file)
Errc SaveData (FILE *file) const
Pobject * Mask (const Pobject *)
Pobject * UnMask (const Pobject *, const Pobject *)
void Set (const std::string &name, BundledObject *bo)
BundledObject * Get (const std::string &name) const
template<typename T>
void SetValue (const std::string &name, const T &val)
template<typename T>
T & GetValue (const std::string &name, const T *) const
template<typename T>
void SetArray (const std::string &name, T *val, Long size)
template<typename T>
T * GetArray (const std::string &name, const T *) const
template<typename T>
Long GetArraySize (const std::string &name, const T *) const
template<typename T>
void SetPobject (const std::string &name, T *val)
template<typename T>
T * GetPobject (const std::string &name, const T *) const
template<typename T>
void SetPArray (const std::string &name, T *val, Long size)
template<typename T>
T ** GetPArray (const std::string &name, const T *) const
template<typename T>
Long GetPArraySize (const std::string &name, const T *) const
template<typename T>
T ** GetNArrays (const std::string &name, Long n, Long &min_out, const T *) const


Member Function Documentation

Pobject* pandore::Collection::Clone  )  const [inline]
 

Creates and returns a distinct copy of this object.

Returns:
the new object.

void pandore::Collection::Delete  )  [inline]
 

Deletes all data in the collection. Bug: map cannot be desallocated item by item with erase(i). So, we use clear().

void pandore::Collection::Erase const std::string &  name  )  [inline]
 

Erases the specified data from the collection.

Parameters:
name the name of the data to be erased.

bool pandore::Collection::Exists const std::string &  name  )  const [inline]
 

Checks if the specified data exist in the collection. e.g.: if (col.Exists("foo")) ...

Parameters:
name the name of the data to be checked.
Returns:
true if data exists in the collection.

BundledObject* pandore::Collection::Get const std::string &  name  )  const [inline]
 

Returns the data with the specified name from the collection.

Parameters:
name the name of data in the collection.
Returns:
the related data.

template<typename T>
T* pandore::Collection::GetArray const std::string &  name,
const T * 
const [inline]
 

Returns the array of data with the specified name from the collection.
Prefer the use of the macro: GETARRAY(name, type) and GETARRAYSIZE(name, type).
See The Collection.

Parameters:
name the name of array of data in the collection.
val the data.
Returns:
the related array of data.

template<typename T>
Long pandore::Collection::GetArraySize const std::string &  name,
const T * 
const [inline]
 

Returns the size of the array of data with the specified name in the collection.

Parameters:
name the name of array of data in the collection.
Prefer the use of the macro: GETARRAYSIZE(name, type).
See The Collection.
val the array of data in the collection.
Returns:
the size of the array.

template<typename T>
T** pandore::Collection::GetNArrays const std::string &  name,
Long  n,
Long &  min_out,
const T * 
const [inline]
 

Returns the list of primitive type arrays with the specified prefix name in the collection. For a given name "foo", each array is named : foo.0, foo.1, ...

Parameters:
name the prefix name of the arrays in the collection.
n the number of arrays to get.
min_out use to return the min size of arrays.
val a dummy used for polymorphim issue (not used).
Returns:
the list of arrays.

template<typename T>
T** pandore::Collection::GetPArray const std::string &  name,
const T * 
const [inline]
 

Returns the array of Pandore objects with the specified name from the collection.
Prefer the use of the macro: GETPARRAY(name, type) and GETPARRAYSIZE(name, type).
See The Collection.

Parameters:
name the name of array of Pobjects in the collection.
val the data.
Returns:
the related array of Pobject.

template<typename T>
Long pandore::Collection::GetPArraySize const std::string &  name,
const T * 
const [inline]
 

Returns the size of the Pandore object array with the specified name in the collection.
Prefer the use of the macro: GETPARRAYSIZE(name, type).
See The Collection.

Parameters:
name the name of the object array in the collection.
val the object array in the collection.
Returns:
the size of the array.

template<typename T>
T* pandore::Collection::GetPobject const std::string &  name,
const T * 
const [inline]
 

Returns the Pandore object with the specified name from the collection.
Prefer the use of the macro: GETPOBJECT(name, type).
See The Collection.

Parameters:
name the name of Pandore object in the collection.
val a dummy used for polymorphim issue (not used).
Returns:
the Pandore object or NULL.

std::string pandore::Collection::GetType const std::string &  name  )  const [inline]
 

Returns the type of the data specified by its name.

Parameters:
name the name of the data.
Returns:
the name of the type.

template<typename T>
T& pandore::Collection::GetValue const std::string &  name,
const T * 
const [inline]
 

Gets the given primitive data with the specified name in the collection. Available primitive types are Uchar, Char, Slong, Float...
Prefer the use of the macro: GETVALUE(name, type);
See The Collection.

Parameters:
name the name of data in the collection.
val the primitive value.
Returns:
the value.

std::list< std::string > pandore::Collection::List  )  const [inline]
 

Returns the list of all data names in the collection.

Returns:
a list of names.

Errc pandore::Collection::LoadAttributes FILE *   )  [inline]
 

Loads attribute values from the specified file. Allocates therefrom the related data.

Parameters:
file the file where to read attributes values.
Returns:
SUCCESS or FAILURE in case of I/O errors.

Errc pandore::Collection::LoadData FILE *  file  ) 
 

Loads data from the specified file.

Parameters:
file the file where to read data.
Returns:
SUCCESS or FAILURE in case of I/O errors.

Pobject* pandore::Collection::Mask const Pobject *   )  [inline]
 

Creates a new collection with the same type but where the data are masked by the given mask. It means that values are set to 0 when the related label in the mask is 0. Not implemented.

Parameters:
mask the region map that is used as a mask.
Returns:
the new collection.

std::string pandore::Collection::Name  )  const [inline]
 

Returns the type name of the type collection (for instance "Collection").

Returns:
the string that contains "Collection".

Errc pandore::Collection::NbOf const std::string &  name,
std::string &  type_out,
Long &  number_out,
Long &  minsize_out
const
 

Returns the number of arrays in a collection of arrays. Each array is named, foo.1, foo.2, ..., if foo is the name of arrays.

Parameters:
name the name of arrays.
type_out use to return the type of the arrays (out)
number_out use to return the number of arrays.
minsize_out use to return the min size of arrays.
Returns:
SUCCESS.

Collection& pandore::Collection::operator= const Collection col  )  [inline]
 

Sets the Collection with the specified collection values. Deletes old values if necessary.

Returns:
the collection itself with its new values.

void pandore::Collection::Rename const std::string &  oldname,
const std::string &  newname
[inline]
 

Renames the specified data with the specified name. e.g.: col.Rename("foo", "bar");

Parameters:
oldname the name of the data to be renamed.
newname the new name of the data.

Errc pandore::Collection::SaveAttributes FILE *  file  )  const [inline]
 

Saves the current attribute values in the specified file.

Parameters:
file the file to be read.
Returns:
SUCCESS or FAILURE in case of I/O errors.

Errc pandore::Collection::SaveData FILE *  file  )  const
 

Saves data in the specified file.

Parameters:
file the file where to save data.
Returns:
SUCCESS or FAILURE in case of I/O errors.

void pandore::Collection::Set const std::string &  name,
BundledObject *  bo
[inline]
 

Sets the given data with the specified name in the collection.

Parameters:
name the name of data in the collection.
bo the data.

template<typename T>
void pandore::Collection::SetArray const std::string &  name,
T *  val,
Long  size
[inline]
 

Sets the given array of primitive data with the specified name in the collection. Available primitive type are Uchar, Char, Short, Float...
Prefer the use of the macro: SETARRAY(name, type, pointer_to_array, number_of_items).
See The Collection.

Parameters:
name the name of the array of data in the collection.
val the array of primitive data.
size the size of the array of primitive data.

template<typename T>
void pandore::Collection::SetPArray const std::string &  name,
T *  val,
Long  size
[inline]
 

Sets the given array of Pandore objects with the specified name in the collection. Available Pandore object are any Pobject.
Prefer the use of the macro: SETPARRAY(name, type, pointer_to_object_array, number_of_items).
See The Collection.

Parameters:
name the name of the array of Pobject in the collection.
val the array of Pandore objects.
size the size of the array.

template<typename T>
void pandore::Collection::SetPobject const std::string &  name,
T *  val
[inline]
 

Sets the given Pandore object with the specified name in the collection. Available Pandore object is any Pobject.
Prefer the use of the macro: SETPOBJECT(name, type, pointer_to_object).
See The Collection.

Parameters:
name the name of the Pandore object in the collection.
val the Pandore object.

template<typename T>
void pandore::Collection::SetValue const std::string &  name,
const T &  val
[inline]
 

Sets the given primitive data with the specified name in the collection. Available primitive types are Uchar, Char, Short, Float...
Prefer the use of the macro: SETVALUE(name, type, value).
See The Collection.

Parameters:
name the name of data in the collection.
val the primitive value.

Typobj pandore::Collection::Type  )  const [inline]
 

Returns the identifier of the type Collection (for instance Po_Collection).

Returns:
the related magic number (an integer).

Pobject* pandore::Collection::UnMask const Pobject *  ,
const Pobject * 
[inline]
 

Creates a new collection with the same type but where the data are ummasked by the given mask and the given reference image. It means that values are set to the value of the reference object when the related label in the mask is 0. Not implemented.

Parameters:
mask the region map that is used as a mask.
reference the object that is used as a reference.
Returns:
the collection itself.


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

The Pantheon project
Image Team GREYC Laboratory
UMR CNRS 6072 - ENSICAEN - University of Caen, France
This page was last modified on 19 June 2015