iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nrt::StreamableGenericBag< FirstT, OtherT...> Class Template Reference

#include <nrt/Core/Design/GenericBag.H>

template<class FirstT, class... OtherT>
class nrt::StreamableGenericBag< FirstT, OtherT...>

A GenericBag class that requires that each of its elements support streaming IO.

This class functions exactly as if it is a GenericBag while allowing convenient access to its contents through streaming IO operations.

This means that each class contained in the Bag must implement the overloaded operators << and >> as expected by IOstream.

It also means that data can easily be entered or retrieved from the bag using these operations:

nrt::StreamableGenericBag<int, bool> bag( 3, true );
std::cout << bag; // displays 3; true

Individual fields are delimited by a semicolon (;)

Definition at line 434 of file GenericBag.H.

Inheritance diagram for nrt::StreamableGenericBag< FirstT, OtherT...>:
nrt::GenericBag< FirstT, OtherT...>

Public Member Functions

 StreamableGenericBag ()
 Default value constructor.
 
 StreamableGenericBag (FirstT const &first, OtherT const &...other)
 Initial value constructor. More...
 
template<class... Types>
 StreamableGenericBag (GenericBag< Types...> const &bag)
 Explicit copy constructor.
 
template<class... Types>
 StreamableGenericBag (StreamableGenericBag< Types...> const &bag)
 Explicit copy constructor.
 
template<class... Types>
 StreamableGenericBag (GenericBag< Types...> &&bag)
 Move construction.
 
template<class... Types>
 StreamableGenericBag (StreamableGenericBag< Types...> &&bag)
 Move constructor.
 
- Public Member Functions inherited from nrt::GenericBag< FirstT, OtherT...>
 GenericBag ()
 Initializes all elements to their default values.
 
 GenericBag (FirstT const &first, OtherT const &...other)
 
template<class FirstT2 , class... OtherT2>
 GenericBag (GenericBag< FirstT2, OtherT2...> const &bag)
 Explicit copy constructor. More...
 
 GenericBag (GenericBag<> const &bag)
 Explicit copy from an empty bag.
 
template<class FirstT2 , class... OtherT2>
 GenericBag (StreamableGenericBag< FirstT2, OtherT2...> const &bag)
 Explicit copy constructor. More...
 
 GenericBag (StreamableGenericBag<> const &bag)
 Explicit copy from an empty bag.
 
template<class FirstT2 , class... OtherT2>
 GenericBag (GenericBag< FirstT2, OtherT2...> &&bag)
 Move constructor. More...
 
 GenericBag (GenericBag<> &&bag)
 Move from empty bag.
 
template<class FirstT2 , class... OtherT2>
 GenericBag (StreamableGenericBag< FirstT2, OtherT2...> &&bag)
 Move constructor. More...
 
 GenericBag (StreamableGenericBag<> &&bag)
 Move from empty bag.
 
template<class T >
getReferenceType< T, FirstT,
OtherT...>::type 
get ()
 Return a reference to the first instance of type T encountered in the bag. More...
 
template<class T >
std::decay< T >::type const & get () const
 Return a const reference to the first instance of type T. More...
 
template<size_t Index>
getIndexType< Index,
GenericBag >::type & 
get ()
 Return a reference to the type at the given index.
 
template<size_t Index>
getIndexType< Index,
GenericBag >::type const & 
get () const
 Return a const reference to the type at the given index.
 
template<class T >
getReferenceType< T, FirstT,
OtherT...>::type 
tryGet ()
 Attempts to return a reference to the first instance of type T encountered in the bag. More...
 
template<class T >
std::decay< T >::type const & tryGet () const
 Attempts to get a constant reference to the first instance of Type T. More...
 
template<class T >
bool const hasType () const
 Checks whether the GenericBag contains a certain type. More...
 
template<class FirstT2 , class... OtherT2>
GenericBag & operator= (GenericBag< FirstT2, OtherT2...> const &bag)
 Assignment operator. More...
 
GenericBag & operator= (GenericBag<> const &bag)
 Assign to empty bag. More...
 
template<class FirstT2 , class... OtherT2>
GenericBag & operator= (StreamableGenericBag< FirstT2, OtherT2...> const &bag)
 Assignment operator. More...
 
GenericBag & operator= (StreamableGenericBag<> const &bag)
 Assign to empty bag. More...
 
template<class FirstT2 , class... OtherT2>
GenericBag & operator= (GenericBag< FirstT2, OtherT2...> &&bag)
 Move Assignment operator. More...
 
GenericBag & operator= (GenericBag<> &&bag)
 Move assign to empty bag. More...
 
template<class FirstT2 , class... OtherT2>
GenericBag & operator= (StreamableGenericBag< FirstT2, OtherT2...> &&bag)
 Move Assignment operator. More...
 
GenericBag & operator= (StreamableGenericBag<> &&bag)
 Move assign to empty bag. More...
 
template<class... RetTypes, class Functor >
GenericBag< RetTypes...> applyFunction (Functor &&f) const
 Apply a function to every element in the bag. More...
 
template<class Functor >
void applyFunctionInPlace (Functor &&f)
 Apply a function in place to every element in the bag. More...
 

Public Attributes

using operator = typedef
 

Protected Member Functions

template<class Archive >
void serialize (Archive &ar)
 
- Protected Member Functions inherited from nrt::GenericBag< FirstT, OtherT...>
FirstT & first ()
 Returns the first element held by this GenericBag.
 
FirstT const & first () const
 Const version of above.
 
GenericBag< OtherT...> & other ()
 Returns the other elements held by this GenericBag.
 
GenericBag< OtherT...> const & other () const
 Const version of above.
 
template<class Archive >
void serialize (Archive &ar)
 

Friends

template<size_t H>
struct streamGenericBagContents
 
struct initiateGenericBagStream
 
class cereal::access
 

Additional Inherited Members

- Protected Types inherited from nrt::GenericBag< FirstT, OtherT...>
typedef FirstT FirstType
 Make FirstT available to helper functionality.
 
- Static Protected Attributes inherited from nrt::GenericBag< FirstT, OtherT...>
static constexpr int height = GenericBag<OtherT...>::height + 1
 Our 'height' in the bag.
 

Constructor & Destructor Documentation

template<class FirstT , class... OtherT>
nrt::StreamableGenericBag< FirstT, OtherT...>::StreamableGenericBag ( FirstT const &  first,
OtherT const &...  other 
)

Initial value constructor.

Parameters
firstInitial value for the first type
otherInitial values in corresponding order to other types

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