Vector< ElementType > Class Template Reference

Generic key whose converter type is StdVector. More...

#include "keyvalue/key/generic/Vector.h"

Inheritance diagram for Vector< ElementType >:
Inheritance graph
[legend]

List of all members.

Public Types

enum  
typedef Traits< ElementType,
StdVector, Default
Traits_
typedef StdVector< typename
Default< ElementType >
::OutputType_ > 
ConverterType_
typedef ConverterType_::InputType_ InputType_
typedef ConverterType_::OutputType_ OutputType_

Public Member Functions

 Vector (const string &name, size_t size=0)
 Constructs the key and sets its name and the expected size of the StdVector content.
string getName () const
 Gets Key's name.
void setName (const string &name)
 Sets name.

Private Member Functions

void checkSize (size_t size) const
 Checks if size matches expected size.

Private Attributes

size_t size_

Detailed Description

template<typename ElementType>
class keyvalue::key::Vector< ElementType >

Generic key whose converter type is StdVector.

On construction, the key name and the expected size of the StdVector content are fixed. (Recall that StdVector holds a std::vector.) At the time the value for this key is requested, the size of StdVector content and its expected size will be compared. If they do not match, then an exception::RuntimeError will be thrown.

Parameters:
ElementType : (template parameter) Vector element type.

Constructor & Destructor Documentation

Vector ( const string &  name,
size_t  size = 0 
) [inline, explicit]

Constructs the key and sets its name and the expected size of the StdVector content.

Parameters:
name : The key name;
size : Expected size. By default, size = 0 which means there is no expected size, i.e., any stricktly positive size for the StdVector content will be accepted.

Member Function Documentation

void checkSize ( size_t  size  )  const [inline, private]

Checks if size matches expected size.

Parameters:
size : The size.

RuntimeError : If size does not match expected size.

string getName (  )  const [inherited]

Gets Key's name.

Returns:
The Key's name.

Reimplemented from Key.

void setName ( const string &  name  )  [inherited]

Sets name.

Parameters:
name : The name.

Generated on Sat Mar 20 15:08:30 2010 for KeyValue by  doxygen 1.6.1