libdap::Str Class Reference

Holds character string data. More...

`#include <Str.h>`

Inheritance diagram for libdap::Str:

## Public Member Functions

unsigned int | buf2val (void **val) override
void | compute_checksum (Crc32 &checksum) override
bool | d4_ops (BaseType *b, int op) override
void | deserialize (D4StreamUnMarshaller &um, DMR &dmr) override
bool | deserialize (UnMarshaller &um, DDS *dds, bool reuse=false) override
void | dump (ostream &strm) const override
| dumps information about this object
virtual string | esc_string_variable_value (const string &s)
| Escape non-printable characters and quotes from a Str variable value. The value printed is used mostly for debugging and for other diagnostics. Strings an non-printable characters are escaped using a backslash.
int | length () const override
int64_t | length_ll () const override
Str & | operator= (const Str &rhs)
bool | ops (BaseType *b, int op) override
void | print_val (FILE *out, string space="", bool print_decl_p=true) override
void | print_val (ostream &out, string space="", bool print_decl_p=true) override
BaseType * | ptr_duplicate () override
bool | serialize (ConstraintEvaluator &eval, DDS &dds, Marshaller &m, bool ce_eval=true) override
void | serialize (D4StreamMarshaller &m, DMR &dmr, bool filter=false) override
| Serialize an Int8.
virtual bool | set_value (const string &value)
| Str (const Str &copy_from)
| Str (const string &n)
| Str (const string &n, const string &d)
unsigned int | val2buf (void *val, bool reuse=false) override
virtual string | value () const
unsigned int | width (bool=false) const override
int64_t | width_ll (bool=false) const override

## Protected Attributes

string | d_buf

## Detailed Description

Holds character string data.

See also
  BaseType
  Url

Definition at line 61 of file Str.h.

## Constructor & Destructor Documentation

## Str() [1/3]

libdap::Str::Str | ( | const string & | n | ) |

The Str constructor requires only the name of the variable to be created. The name may be omitted, which will create a nameless variable. This may be adequate for some applications.

Parameters

  n | A string containing the name of the variable to be created.

Definition at line 91 of file Str.cc.

## Str() [2/3]

libdap::Str::Str | ( | const string & | n,
|  | const string & | d )

The Str server-side constructor accepts the name of the variable and the dataset name from which this instance is created.

Parameters

  n | A string containing the name of the variable to be created.
  d | A string containing the name of the dataset from which this variable is created

Definition at line 100 of file Str.cc.

## ~Str()

virtual libdap::Str::~Str | ( |  | ) |

inline virtual

Definition at line 69 of file Str.h.

## Str() [3/3]

libdap::Str::Str | ( | const Str & | copy_from | ) |

Definition at line 102 of file Str.cc.

## Member Function Documentation

## buf2val()

unsigned int libdap::Str::buf2val | ( | void ** | val | ) |

override

Read the object's value and put a copy in the C++ string object referenced by **val. If *val is null, this method will allocate a string object using new and store the result there. If *val is not null, it will assume that *val references a string object and put the value there.

Parameters

  val | A pointer to null or to a string object.

Returns
  The sizeof(string*)

Exceptions

  InternalErr | Thrown if val is null.

Definition at line 177 of file Str.cc.

## compute_checksum()

void libdap::Str::compute_checksum | ( | Crc32 & | checksum | ) |

override

Definition at line 147 of file Str.cc.

## d4_ops()

bool libdap::Str::d4_ops | ( | BaseType * | b,
|  | int | op )

override

See also
  BaseType::d4_ops(BaseType *, int)

Definition at line 281 of file Str.cc.

## deserialize() [1/2]

void libdap::Str::deserialize | ( | D4StreamUnMarshaller & | um,
|  | DMR & | dmr )

override

Definition at line 166 of file Str.cc.

## deserialize() [2/2]

bool libdap::Str::deserialize | ( | UnMarshaller & | um,
|  | DDS * | dds,
|  | bool | reuse = false )

override

Definition at line 141 of file Str.cc.

## dump()

void libdap::Str::dump | ( | ostream & | strm | ) | const

override

dumps information about this object

Displays the pointer value of this instance and information about this instance.

Parameters

  strm | C++ i/o stream to dump the information to

Returns
  void

Definition at line 311 of file Str.cc.

## esc_string_variable_value()

string libdap::Str::esc_string_variable_value | ( | const string & | s | ) |

virtual

Escape non-printable characters and quotes from a Str variable value. The value printed is used mostly for debugging and for other diagnostics. Strings an non-printable characters are escaped using a backslash.

Parameters

  s | The value to modify.

Returns
  The modified value.

Definition at line 243 of file Str.cc.

## length()

int libdap::Str::length | ( |  | ) | const

override

Definition at line 114 of file Str.cc.

## length_ll()

int64_t libdap::Str::length_ll | ( |  | ) | const

override

Definition at line 116 of file Str.cc.

## operator=()

Str & libdap::Str::operator= | ( | const Str & | rhs | ) |

Definition at line 106 of file Str.cc.

## ops()

bool libdap::Str::ops | ( | BaseType * | b,
|  | int | op )

override

Definition at line 254 of file Str.cc.

## print_val() [1/2]

void libdap::Str::print_val | ( | FILE * | out,
|  | string | space = "",
|  | bool | print_decl_p = true )

override

Definition at line 230 of file Str.cc.

## print_val() [2/2]

void libdap::Str::print_val | ( | ostream & | out,
|  | string | space = "",
|  | bool | print_decl_p = true )

override

Definition at line 245 of file Str.cc.

## ptr_duplicate()

BaseType * libdap::Str::ptr_duplicate | ( |  | ) |

override

Definition at line 104 of file Str.cc.

## serialize() [1/2]

bool libdap::Str::serialize | ( | ConstraintEvaluator & | eval,
|  | DDS & | dds,
|  | Marshaller & | m,
|  | bool | ce_eval = true )

override

Definition at line 118 of file Str.cc.

## serialize() [2/2]

void libdap::Str::serialize | ( | D4StreamMarshaller & | m,
|  | DMR & | dmr,
|  | bool | filter = false )

override

Serialize an Int8.

Parameters

  m |
  dmr | Unused
  eval | Unused
  filter | Unused

Exceptions

  Error | is thrown if the value needs to be read and that operation fails.

Definition at line 159 of file Str.cc.

## set_value()

bool libdap::Str::set_value | ( | const string & | value | ) |

virtual

Set the value of this instance.

Parameters

  value | The value

Returns
  Always returns true; the return type of bool is for compatibility with the Passive* subclasses written by HAO.

Definition at line 219 of file Str.cc.

## val2buf()

unsigned int libdap::Str::val2buf | ( | void * | val,
|  | bool | reuse = false )

override

Store the value referenced by val in this object. Even though the type of val is `void*`, this method assumes the type is `string*`. Note that the value is copied so the caller if free to throw away/reuse the actual parameter once this call has returned.

Parameters

  val | A pointer to a C++ string object.
  reuse | Not used by this version of the method.

Exceptions

  IntenalErr | if val is null.

Returns
  The width of the pointer.

Definition at line 202 of file Str.cc.

## value()

string libdap::Str::value | ( |  | ) | const

virtual

Get the value of this instance.

Returns
  The value.

Definition at line 228 of file Str.cc.

## width()

unsigned int libdap::Str::width | ( | bool | = false | ) | const

inline override

Definition at line 77 of file Str.h.

## width_ll()

int64_t libdap::Str::width_ll | ( | bool | = false | ) | const

inline override

Definition at line 79 of file Str.h.

## Member Data Documentation

## d_buf

string libdap::Str::d_buf

protected

Definition at line 63 of file Str.h.

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

- Str.h
- Str.cc