shards Version of the Day
Loading...
Searching...
No Matches

Abstract base class for array dimension tags supplied to the Array template class. More...

#include <Shards_Array.hpp>

Inheritance diagram for shards::ArrayDimTag:
shards::ArrayDimension

Public Types

typedef array_traits::int_t size_type
 

Public Member Functions

virtual const charname () const =0
 Name of the tag, typically the name of the derived class.
 
virtual std::string to_string (size_type dimension, size_type index) const
 Given a dimension and index produce a string for output.
 
virtual size_type to_index (size_type dimension, const std::string &label) const
 Given a dimension and input strige produce an index.
 

Detailed Description

Abstract base class for array dimension tags supplied to the Array template class.

See also
Array

A derived array dimension tag class must provide the name method and tag singleton method as in the following example.

struct MyTag : public shards::ArrayDimTag {
  const char * name() const ;
  static const MyTag & tag();
};

An example implementation of these methods is as follows.

const char * MyTag::name() const
{ static const char my_name[] = "MyTag" ; return my_name ; }

const MyTag & MyTag::tag()
{ static const MyTag my_tag ; return my_tag ; }

Definition at line 133 of file Shards_Array.hpp.

Member Typedef Documentation

◆ size_type

typedef array_traits::int_t shards::ArrayDimTag::size_type

Definition at line 136 of file Shards_Array.hpp.

Constructor & Destructor Documentation

◆ ArrayDimTag()

shards::ArrayDimTag::ArrayDimTag ( )
inlineprotected

Definition at line 157 of file Shards_Array.hpp.

Member Function Documentation

◆ name()

virtual const char * shards::ArrayDimTag::name ( ) const
pure virtual

Name of the tag, typically the name of the derived class.

Implemented in shards::ArrayDimension.

◆ to_string()

virtual std::string shards::ArrayDimTag::to_string ( size_type dimension,
size_type index ) const
virtual

Given a dimension and index produce a string for output.

    Default to converting <b> index </b> to a string.

◆ to_index()

virtual size_type shards::ArrayDimTag::to_index ( size_type dimension,
const std::string & label ) const
virtual

Given a dimension and input strige produce an index.

    Default to converting <b> label </b> to an integer.

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