SheafSystem  0.0.0.0
sheaf::arg_list Class Reference

A whitespace separated list of arguments. Insertion operaters are used to insert arguments into the list. C++ strings are treated as string literals. The value of the string is inserted into arg_list. More...

#include <arg_list.h>

Classes

struct  arg_type
 The internal argument type. More...
 

Public Member Functions

 arg_list ()
 Default constructor. More...
 
 arg_list (const arg_list &xinput)
 Copy constructor. More...
 
 arg_list (const arg_type &xarg)
 Creates an instance with arg xarg. More...
 
 arg_list (const char *xarg_name)
 Creates an instance with one arg with name xarg_name; if xarg_name is empty, creates an empty arg_list. Intended for initializing empty arg_lists with string literal "". More...
 
unsigned int ct () const
 The number of arguments. More...
 
bool empty () const
 True if and only if there are no arguments in the list. More...
 
int index (const std::string &xname) const
 The index of the argument with name xname. More...
 
const std::string & name (int xi) const
 The name of the xi-th argument. More...
 
int type (int xi) const
 The type of the xi-th argument. More...
 
int type (const std::string &xname) const
 The type of the argument with name xname. More...
 
primitive_valuevalue (int xi)
 The value of the xi-th argument. More...
 
const primitive_valuevalue (int xi) const
 The value of the xi-th argument, const version. More...
 
primitive_valuevalue (const std::string &xname)
 The value of argument with name xname. More...
 
const primitive_valuevalue (const std::string &xname) const
 The value of argument with name xname, const version. More...
 
arg_listoperator+= (const arg_list &xother)
 Append arg_list xother. More...
 
arg_listoperator<< (const primitive_value &xinput)
 Insert a primitive value. More...
 
bool parsing_name () const
 True if next token should be an argument name. More...
 
bool parsing_value () const
 True if next token should be an argument value. More...
 
bool parsing_error () const
 True if argument input has found an error. More...
 
bool conforms_to (const namespace_poset &xns, const poset_path &xschema_path, bool xuse_table_schema, bool xauto_access) const
 True if the values in this conform to the table schema (xuse_table_schema true) or row schema (xuse_table_schema false) specified by xschema_path. More...
 
bool conforms_to (const schema_poset_member &xschema, bool xuse_table_schema, bool xauto_access) const
 True if the values in this conform to the table schema (xuse_table_schema true) or row schema (xuse_table_schema false) specified by xschema. More...
 
bool conforms_to_extension (const namespace_poset &xns, const poset_path &xschema_path, const poset_path &xstd_schema_path, bool xuse_table_schema, bool xauto_access) const
 True if the values in this conform to the table schema (xuse_table_schema true) or row schema (xuse_table_schema false) specified by the part of xschema_path that is not contained in xstd_schema_path. More...
 
bool conforms_to_extension (const schema_poset_member &xschema, const schema_poset_member &xstd_schema, bool xuse_table_schema, bool xauto_access) const
 True if the values in this conform to the table schema (xuse_table_schema true) or row schema (xuse_table_schema false) specified by the part of xschema that is not contained in xstd_schema. More...
 
void clear ()
 Removes all arguments. More...
 
arg_typearg (int xi)
 The xi-th arg. More...
 
const arg_typearg (int xi) const
 The xi-th arg. More...
 
bool contains_arg (const std::string &xname) const
 True if and only if this contains an arg with name xname. More...
 
bool contains_args (const arg_list &xother) const
 True if and only if this contains all the args of xother. More...
 
arg_typearg (const std::string &xname)
 The arg with name xname. More...
 
const arg_typearg (const std::string &xname) const
 The arg with name xname. More...
 
arg_typeback ()
 The last arg. More...
 
const arg_typeback () const
 The last arg, const version. More...
 
void push_back (const arg_type &xarg)
 

Friends

SHEAF_DLL_SPEC std::ostream & operator<< (std::ostream &os, const arg_list &xf)
 Insert arg_list p into ostream os. More...
 
SHEAF_DLL_SPEC std::istream & operator>> (std::istream &is, arg_list &xf)
 Extract arg_list p from istream is. More...
 

Detailed Description

A whitespace separated list of arguments. Insertion operaters are used to insert arguments into the list. C++ strings are treated as string literals. The value of the string is inserted into arg_list.

Todo:
Need some way to reset this list and a way to easily iterate through the list.

Definition at line 63 of file arg_list.h.

Constructor & Destructor Documentation

◆ arg_list() [1/4]

sheaf::arg_list::arg_list ( )

Default constructor.

Definition at line 41 of file arg_list.cc.

Referenced by arg_list().

◆ arg_list() [2/4]

sheaf::arg_list::arg_list ( const arg_list xinput)

Copy constructor.

Postcondition
  • contains_args(xinput)

Definition at line 58 of file arg_list.cc.

References arg_list(), and contains_args().

◆ arg_list() [3/4]

sheaf::arg_list::arg_list ( const arg_type xarg)

Creates an instance with arg xarg.

Postcondition

Definition at line 77 of file arg_list.cc.

References arg_list(), back(), sheaf::arg_list::arg_type::empty(), empty(), and push_back().

◆ arg_list() [4/4]

sheaf::arg_list::arg_list ( const char *  xarg_name)

Creates an instance with one arg with name xarg_name; if xarg_name is empty, creates an empty arg_list. Intended for initializing empty arg_lists with string literal "".

Postcondition
  • empty() == (strlen(xarg_name) == 0)
  • !empty() ? back().name == xarg_name : true

Definition at line 106 of file arg_list.cc.

References back(), ct(), sheaf::arg_list::arg_type::empty(), empty(), name(), and push_back().

Member Function Documentation

◆ arg() [1/4]

sheaf::arg_list::arg_type & sheaf::arg_list::arg ( int  xi)

The xi-th arg.

Precondition
  • (0 <= xi) && (xi < ct())

Definition at line 989 of file arg_list.cc.

References ct().

Referenced by arg(), contains_args(), sheaf::deep_size(), sheaf::table_dof_tuple_record::transfer_poset_to_internal_buffer(), type(), and value().

◆ arg() [2/4]

const sheaf::arg_list::arg_type & sheaf::arg_list::arg ( int  xi) const

The xi-th arg.

Precondition
  • (0 <= xi) && (xi < ct())

Definition at line 1011 of file arg_list.cc.

References contains_arg(), and ct().

◆ arg() [3/4]

sheaf::arg_list::arg_type & sheaf::arg_list::arg ( const std::string &  xname)

The arg with name xname.

Precondition
  • contains_arg(xname)

Definition at line 1084 of file arg_list.cc.

References arg(), contains_arg(), and index().

◆ arg() [4/4]

const sheaf::arg_list::arg_type & sheaf::arg_list::arg ( const std::string &  xname) const

The arg with name xname.

Precondition
  • contains_arg(xname)

Definition at line 1108 of file arg_list.cc.

References arg(), back(), contains_arg(), and index().

◆ back() [1/2]

sheaf::arg_list::arg_type & sheaf::arg_list::back ( )

The last arg.

Precondition

Definition at line 1132 of file arg_list.cc.

References ct().

Referenced by arg(), and arg_list().

◆ back() [2/2]

const sheaf::arg_list::arg_type & sheaf::arg_list::back ( ) const

The last arg, const version.

Precondition

Definition at line 1154 of file arg_list.cc.

References ct(), and push_back().

◆ clear()

void sheaf::arg_list::clear ( )

Removes all arguments.

Postcondition

Definition at line 729 of file arg_list.cc.

References ct(), and sheaf::arg_list::arg_type::put_type().

Referenced by conforms_to_extension().

◆ conforms_to() [1/2]

bool sheaf::arg_list::conforms_to ( const namespace_poset xns,
const poset_path xschema_path,
bool  xuse_table_schema,
bool  xauto_access 
) const

True if the values in this conform to the table schema (xuse_table_schema true) or row schema (xuse_table_schema false) specified by xschema_path.

Precondition
  • xauto_access || xns.state_is_read_accessible()
  • xschema_path.member_exists(xauto_access)
  • xauto_access || xschema_path.state_is_read_accessible(xauto_access)

Definition at line 529 of file arg_list.cc.

References sheaf::poset_path::member_exists(), sheaf::read_write_monitor_handle::state_is_read_accessible(), and sheaf::poset_path::state_is_read_accessible().

Referenced by sheaf::poset_dof_map::get_dof_tuple(), fiber_bundle::product_section_space_schema_poset::new_state(), parsing_error(), sheaf::poset_dof_map::put_dof_tuple(), and fiber_bundle::section_space_schema_poset::rep_is_valid().

◆ conforms_to() [2/2]

bool sheaf::arg_list::conforms_to ( const schema_poset_member xschema,
bool  xuse_table_schema,
bool  xauto_access 
) const

True if the values in this conform to the table schema (xuse_table_schema true) or row schema (xuse_table_schema false) specified by xschema.

Precondition
  • xauto_access || xschema.state_is_read_accessible()

Definition at line 560 of file arg_list.cc.

References conforms_to_extension(), sheaf::schema_poset_member::dof_iterator(), sheaf::poset_dof_iterator::force_is_done(), sheaf::poset_component::get_read_access(), sheaf::poset_dof_iterator::is_done(), sheaf::poset_dof_iterator::item(), sheaf::poset_dof_iterator::next(), sheaf::poset_component::release_access(), and sheaf::read_write_monitor_handle::state_is_read_accessible().

◆ conforms_to_extension() [1/2]

bool sheaf::arg_list::conforms_to_extension ( const namespace_poset xns,
const poset_path xschema_path,
const poset_path xstd_schema_path,
bool  xuse_table_schema,
bool  xauto_access 
) const

True if the values in this conform to the table schema (xuse_table_schema true) or row schema (xuse_table_schema false) specified by the part of xschema_path that is not contained in xstd_schema_path.

Precondition
  • xauto_access || xns.state_is_read_accessible()
  • xschema_path.member_exists(xauto_access)
  • xauto_access || xschema_path.state_is_read_accessible(xauto_access)
  • xstd_schema_path.member_exists(xauto_access)
  • xschema_path.conforms_to(xstd_schema_path, xauto_access)

Definition at line 618 of file arg_list.cc.

References sheaf::poset_path::conforms_to(), sheaf::schema_poset_member::detach_from_state(), sheaf::poset_path::member_exists(), sheaf::read_write_monitor_handle::state_is_read_accessible(), and sheaf::poset_path::state_is_read_accessible().

Referenced by conforms_to().

◆ conforms_to_extension() [2/2]

bool sheaf::arg_list::conforms_to_extension ( const schema_poset_member xschema,
const schema_poset_member xstd_schema,
bool  xuse_table_schema,
bool  xauto_access 
) const

True if the values in this conform to the table schema (xuse_table_schema true) or row schema (xuse_table_schema false) specified by the part of xschema that is not contained in xstd_schema.

Precondition
  • xauto_access || xschema.state_is_read_accessible()
  • xschema.conforms_to(xstd_schema)

Definition at line 655 of file arg_list.cc.

References clear(), sheaf::schema_poset_member::conforms_to(), sheaf::poset_dof_iterator::ct(), sheaf::schema_poset_member::dof_iterator(), sheaf::poset_component::get_read_access(), sheaf::poset_component::index(), sheaf::poset_component::release_access(), and sheaf::read_write_monitor_handle::state_is_read_accessible().

◆ contains_arg()

bool sheaf::arg_list::contains_arg ( const std::string &  xname) const

True if and only if this contains an arg with name xname.

Precondition

Definition at line 1033 of file arg_list.cc.

References contains_args(), and index().

Referenced by arg(), contains_args(), type(), and value().

◆ contains_args()

bool sheaf::arg_list::contains_args ( const arg_list xother) const

True if and only if this contains all the args of xother.

Definition at line 1051 of file arg_list.cc.

References arg(), contains_arg(), and sheaf::arg_list::arg_type::name.

Referenced by arg_list(), contains_arg(), and operator+=().

◆ ct()

◆ empty()

bool sheaf::arg_list::empty ( ) const

True if and only if there are no arguments in the list.

Postcondition
  • result == (ct() == 0)

Definition at line 146 of file arg_list.cc.

References ct(), and index().

Referenced by arg_list(), and ct().

◆ index()

int sheaf::arg_list::index ( const std::string &  xname) const

The index of the argument with name xname.

Precondition
Postcondition
  • (-1 <= result) && (result < static_cast<int>(ct()))

Definition at line 168 of file arg_list.cc.

References ct(), and name().

Referenced by arg(), contains_arg(), sheaf::deep_size(), empty(), and sheaf::poset_dof_map::put_dof_tuple().

◆ name()

const std::string & sheaf::arg_list::name ( int  xi) const

The name of the xi-th argument.

Precondition

Definition at line 200 of file arg_list.cc.

References ct(), and type().

Referenced by arg_list(), sheaf::deep_size(), and index().

◆ operator+=()

sheaf::arg_list & sheaf::arg_list::operator+= ( const arg_list xother)

Append arg_list xother.

Postcondition
  • contains_args(xother)

Definition at line 380 of file arg_list.cc.

References contains_args(), and operator<<.

Referenced by value().

◆ operator<<()

sheaf::arg_list & sheaf::arg_list::operator<< ( const primitive_value xinput)

Insert a primitive value.

Definition at line 405 of file arg_list.cc.

References sheaf::primitive_value::id(), parsing_name(), and sheaf::primitive_value::value().

◆ parsing_error()

bool sheaf::arg_list::parsing_error ( ) const

True if argument input has found an error.

Definition at line 507 of file arg_list.cc.

References conforms_to().

Referenced by parsing_value().

◆ parsing_name()

bool sheaf::arg_list::parsing_name ( ) const

True if next token should be an argument name.

Definition at line 459 of file arg_list.cc.

References parsing_value().

Referenced by operator<<(), and push_back().

◆ parsing_value()

bool sheaf::arg_list::parsing_value ( ) const

True if next token should be an argument value.

Definition at line 483 of file arg_list.cc.

References parsing_error().

Referenced by parsing_name().

◆ push_back()

void sheaf::arg_list::push_back ( const arg_type xarg)
Precondition
Postcondition
  • ct() == old_ct + 1

Definition at line 1176 of file arg_list.cc.

References ct(), and parsing_name().

Referenced by arg_list(), back(), and sheaf::poset_dof_map::get_dof_tuple().

◆ type() [1/2]

int sheaf::arg_list::type ( int  xi) const

The type of the xi-th argument.

Precondition

Definition at line 222 of file arg_list.cc.

References ct().

Referenced by sheaf::deep_size(), and name().

◆ type() [2/2]

int sheaf::arg_list::type ( const std::string &  xname) const

The type of the argument with name xname.

Precondition
  • contains_arg(xname)

Definition at line 244 of file arg_list.cc.

References arg(), contains_arg(), sheaf::arg_list::arg_type::type(), and value().

◆ value() [1/4]

◆ value() [2/4]

const sheaf::primitive_value & sheaf::arg_list::value ( int  xi) const

The value of the xi-th argument, const version.

Precondition

Definition at line 289 of file arg_list.cc.

References ct(), and value().

◆ value() [3/4]

sheaf::primitive_value & sheaf::arg_list::value ( const std::string &  xname)

The value of argument with name xname.

Precondition
  • contains_arg(xname)

Definition at line 311 of file arg_list.cc.

References arg(), contains_arg(), sheaf::arg_list::arg_type::value, and value().

◆ value() [4/4]

const sheaf::primitive_value & sheaf::arg_list::value ( const std::string &  xname) const

The value of argument with name xname, const version.

Precondition
  • contains_arg(xname)

Definition at line 334 of file arg_list.cc.

References arg(), contains_arg(), operator+=(), and sheaf::arg_list::arg_type::value.

Friends And Related Function Documentation

◆ operator<<

SHEAF_DLL_SPEC std::ostream& operator<< ( std::ostream &  os,
const arg_list xf 
)
friend

Insert arg_list p into ostream os.

Referenced by operator+=().

◆ operator>>

SHEAF_DLL_SPEC std::istream& operator>> ( std::istream &  is,
arg_list xf 
)
friend

Extract arg_list p from istream is.


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