![]() |
Reference documentation for deal.II version 8.1.0
|
#include <named_data.h>
Public Member Functions | |
NamedData () | |
template<typename DATA2 > | |
NamedData< DATA > & | operator= (const NamedData< DATA2 > &other) |
DeclException2 (ExcNameMismatch, int, std::string,<< "Name at position "<< arg1<< " is not equal to "<< arg2) | |
DeclException0 (ExcConstantObject) | |
Adding members | |
void | add (DATA &v, const std::string &name) |
void | add (const DATA &v, const std::string &name) |
template<typename DATA2 > | |
void | merge (NamedData< DATA2 > &) |
template<typename DATA2 > | |
void | merge (const NamedData< DATA2 > &) |
Accessing and querying | |
contents | |
unsigned int | size () const |
Number of stored data objects. | |
DATA & | operator() (unsigned int i) |
Access to stored data object by index. More... | |
const DATA & | operator() (unsigned int i) const |
Read-only access to stored data object by index. | |
const DATA & | read (unsigned int i) const |
Read only access for a non-const object. | |
const std::string & | name (unsigned int i) const |
Name of object at index. | |
unsigned int | find (const std::string &name) const |
Find index of a named object. | |
bool | is_const () const |
Returns true if this object contains constant data. | |
template<class OUT > | |
void | print (OUT &o) const |
List names of stored objects. | |
![]() | |
Subscriptor () | |
Subscriptor (const Subscriptor &) | |
virtual | ~Subscriptor () |
Subscriptor & | operator= (const Subscriptor &) |
void | subscribe (const char *identifier=0) const |
void | unsubscribe (const char *identifier=0) const |
unsigned int | n_subscriptions () const |
void | list_subscribers () const |
DeclException3 (ExcInUse, int, char *, std::string &,<< "Object of class "<< arg2<< " is still used by "<< arg1<< " other objects.\n"<< "(Additional information: "<< arg3<< ")\n"<< "Note the entry in the Frequently Asked Questions of "<< "deal.II (linked to from http://www.dealii.org/) for "<< "more information on what this error means.") | |
DeclException2 (ExcNoSubscriber, char *, char *,<< "No subscriber with identifier \""<< arg2<< "\" did subscribe to this object of class "<< arg1) | |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
Private Attributes | |
bool | is_constant |
True if the object is to be treated constant. | |
std::vector< DATA > | data |
The actual data stored. | |
std::vector< std::string > | names |
Names for the data. | |
This class is a collection of DATA objects. Each of the pointers has a name associated, enabling identification by this name rather than the index in the vector only.
Note that it is the actual data stored in this object. Therefore, for storing vectors and other large objects, it should be considered to use SmartPointer or boost::shared_ptr for DATA.
Objects of this kind have a smart way of treating constness: if a const data object is added or a const NamedData is supplied with merge(), the object will henceforth consider itself as const (is_constant will be true). Thus, any subsequent modification will be illegal and ExcConstantObject will be raised in debug mode.
Definition at line 48 of file named_data.h.
Standard constructor creating an empty object.
Definition at line 244 of file named_data.h.
|
inline |
Assignment operator, copying conversible data from another object.
Definition at line 312 of file named_data.h.
|
inline |
Add a new data item to the end of the collection.
Definition at line 253 of file named_data.h.
|
inline |
Add a new constant data item to the end of the collection and make the collection constant.
Definition at line 264 of file named_data.h.
|
inline |
Merge the data of another NamedData to the end of this object.
If the other object had is_constant set, so will have this object after merge.
Definition at line 278 of file named_data.h.
|
inline |
Merge the data of another NamedData to the end of this object.
After this operation, all data in this object will be treated as const.
Definition at line 295 of file named_data.h.
Access to stored data object by index.
true
. In such a case, either cast the NamedData object to a const reference, or use the function read() instead of this operator. Definition at line 343 of file named_data.h.
NamedData< DATA >::DeclException2 | ( | ExcNameMismatch | , |
int | , | ||
std::string | , | ||
<< "Name at position "<< arg1<< " is not equal to "<< | arg2 | ||
) |
Exception indicating that a function expected a vector to have a certain name, but NamedData had a different name in that position.
NamedData< DATA >::DeclException0 | ( | ExcConstantObject | ) |
Exception indicating that read access to stored data was attempted although the NamedData object contains const data and is_constant was true.