lsst.afw  14.0-56-gfbf220870
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
lsst::afw::table::FieldBase< std::string > Struct Template Reference

Field base class specialization for strings. More...

#include <FieldBase.h>

Inheritance diagram for lsst::afw::table::FieldBase< std::string >:
lsst::afw::table::Key< std::string >

Public Types

typedef std::string Value
 the type returned by BaseRecord::get More...
 
typedef char * Reference
 the type returned by BaseRecord::operator[] More...
 
typedef char const * ConstReference
 the type returned by BaseRecord::operator[] (const) More...
 
typedef char Element
 the type of subfields and array elements More...
 

Public Member Functions

 FieldBase (int size=-1)
 Construct a FieldBase with the given size. More...
 
 FieldBase (FieldBase const &)=default
 
 FieldBase (FieldBase &&)=default
 
FieldBase & operator= (FieldBase const &)=default
 
FieldBase & operator= (FieldBase &&)=default
 
 ~FieldBase ()=default
 
int getElementCount () const
 Return the number of subfield elements (equal to the size of the string, including a null terminator), or 0 for a variable-length string. More...
 
int getSize () const
 Return the maximum length of the string, including a null terminator (equal to the number of subfield elements), or 0 for a variable-length string. More...
 
bool isVariableLength () const
 Return true if the field is variable-length (each record can have a different size array). More...
 

Static Public Member Functions

static std::string getTypeString ()
 Return a string description of the field type. More...
 

Protected Member Functions

void stream (std::ostream &os) const
 Defines how Fields are printed. More...
 
Reference getReference (Element *p, ndarray::Manager::Ptr const &m) const
 Used to implement BaseRecord::operator[] (non-const). More...
 
ConstReference getConstReference (Element const *p, ndarray::Manager::Ptr const &m) const
 Used to implement BaseRecord::operator[] (const). More...
 
Value getValue (Element const *p, ndarray::Manager::Ptr const &m) const
 Used to implement BaseRecord::get. More...
 
void setValue (Element *p, ndarray::Manager::Ptr const &, std::string const &value) const
 Used to implement BaseRecord::set Fixed-lengths strings are handled by copying the data into p through p + _size, nulling extra characters, if any. More...
 

Static Protected Member Functions

static FieldBase makeDefault ()
 Needed to allow Keys to be default-constructed. More...
 

Detailed Description

template<>
struct lsst::afw::table::FieldBase< std::string >

Field base class specialization for strings.

Definition at line 225 of file FieldBase.h.

Member Typedef Documentation

◆ ConstReference

the type returned by BaseRecord::operator[] (const)

Definition at line 232 of file FieldBase.h.

◆ Element

the type of subfields and array elements

Definition at line 234 of file FieldBase.h.

◆ Reference

the type returned by BaseRecord::operator[]

Definition at line 229 of file FieldBase.h.

◆ Value

the type returned by BaseRecord::get

Definition at line 226 of file FieldBase.h.

Constructor & Destructor Documentation

◆ FieldBase() [1/3]

Construct a FieldBase with the given size.

A size == 0 indicates a variable-length string. Negative sizes are not permitted.

This constructor is implicit and has an invalid default so it can be used in the Field constructor (as if it were an int argument) without specializing Field. In other words, it allows one to construct a 25-character string field like this:

Field< std::string >("name", "documentation", 25);

...even though the third argument to the Field constructor takes a FieldBase, not an int.

◆ FieldBase() [2/3]

◆ FieldBase() [3/3]

◆ ~FieldBase()

Member Function Documentation

◆ getConstReference()

ConstReference lsst::afw::table::FieldBase< std::string >::getConstReference ( Element const *  p,
ndarray::Manager::Ptr const &  m 
) const
inlineprotected

Used to implement BaseRecord::operator[] (const).

Definition at line 289 of file FieldBase.h.

◆ getElementCount()

int lsst::afw::table::FieldBase< std::string >::getElementCount ( ) const
inline

Return the number of subfield elements (equal to the size of the string, including a null terminator), or 0 for a variable-length string.

Definition at line 262 of file FieldBase.h.

◆ getReference()

Reference lsst::afw::table::FieldBase< std::string >::getReference ( Element *  p,
ndarray::Manager::Ptr const &  m 
) const
inlineprotected

Used to implement BaseRecord::operator[] (non-const).

Definition at line 278 of file FieldBase.h.

◆ getSize()

int lsst::afw::table::FieldBase< std::string >::getSize ( ) const
inline

Return the maximum length of the string, including a null terminator (equal to the number of subfield elements), or 0 for a variable-length string.

Definition at line 266 of file FieldBase.h.

◆ getTypeString()

static std::string lsst::afw::table::FieldBase< std::string >::getTypeString ( )
static

Return a string description of the field type.

◆ getValue()

Value lsst::afw::table::FieldBase< std::string >::getValue ( Element const *  p,
ndarray::Manager::Ptr const &  m 
) const
protected

Used to implement BaseRecord::get.

◆ isVariableLength()

bool lsst::afw::table::FieldBase< std::string >::isVariableLength ( ) const
inline

Return true if the field is variable-length (each record can have a different size array).

Definition at line 269 of file FieldBase.h.

◆ makeDefault()

static FieldBase lsst::afw::table::FieldBase< std::string >::makeDefault ( )
inlinestaticprotected

Needed to allow Keys to be default-constructed.

Definition at line 272 of file FieldBase.h.

◆ operator=() [1/2]

FieldBase& lsst::afw::table::FieldBase< std::string >::operator= ( FieldBase< std::string > const &  )
default

◆ operator=() [2/2]

◆ setValue()

void lsst::afw::table::FieldBase< std::string >::setValue ( Element *  p,
ndarray::Manager::Ptr const &  ,
std::string const &  value 
) const
protected

Used to implement BaseRecord::set Fixed-lengths strings are handled by copying the data into p through p + _size, nulling extra characters, if any.

The data is only null-terminated if value.size() < _size. Variable-length strings are handled by setting p to the address of a std::string that is a copy of value

◆ stream()

void lsst::afw::table::FieldBase< std::string >::stream ( std::ostream &  os) const
inlineprotected

Defines how Fields are printed.

Definition at line 275 of file FieldBase.h.


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