LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
coding.cc File Reference
#include "fhiclcpp/coding.h"
#include "cetlib/canonical_number.h"
#include "cetlib/canonical_string.h"
#include "fhiclcpp/ParameterSet.h"
#include "fhiclcpp/ParameterSetRegistry.h"
#include <cstddef>
#include <cstdlib>
#include <limits>
#include <stdexcept>

Go to the source code of this file.

Functions

static std::string canon_nil ()
 
static ps_atom_t literal_true ()
 
static ps_atom_t literal_false ()
 
static ps_atom_t literal_infinity ()
 
static void atom_rep (any const &a, std::string &result)
 

Function Documentation

static void atom_rep ( any const &  a,
std::string &  result 
)
static

Definition at line 58 of file coding.cc.

References fhicl::detail::is_sequence(), fhicl::detail::is_table(), and fhicl::type_mismatch.

Referenced by fhicl::detail::encode(), and fhicl::detail::is_nil().

59 {
60  if (is_table(a))
61  throw fhicl::exception(type_mismatch, "can't obtain atom from table");
62  if (is_sequence(a))
63  throw fhicl::exception(type_mismatch, "can't obtain atom from sequence");
64 
65  result = any_cast<std::string>(a);
66 #if 0
67  if( result.size() >= 2 && result[0] == '\"' && result.end()[-1] == '\"' )
68  result = cet::unescape( result.substr(1, result.size()-2) );
69 #endif // 0
70 }
bool is_sequence(boost::any const &val)
Definition: coding.h:50
bool is_table(boost::any const &val)
Definition: coding.h:56
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
static std::string canon_nil ( )
inlinestatic

Definition at line 30 of file coding.cc.

Referenced by fhicl::detail::encode(), and fhicl::detail::is_nil().

31 {
32  static std::string const canon_nil(9, '\0');
33  return canon_nil;
34 }
static std::string canon_nil()
Definition: coding.cc:30
static ps_atom_t literal_false ( )
inlinestatic

Definition at line 44 of file coding.cc.

Referenced by fhicl::detail::encode().

45 {
46  static std::string literal_false("false");
47  return literal_false;
48 }
static ps_atom_t literal_false()
Definition: coding.cc:44
static ps_atom_t literal_infinity ( )
inlinestatic

Definition at line 51 of file coding.cc.

Referenced by fhicl::detail::encode().

52 {
53  static std::string literal_infinity("infinity");
54  return literal_infinity;
55 }
static ps_atom_t literal_infinity()
Definition: coding.cc:51
static ps_atom_t literal_true ( )
inlinestatic

Definition at line 37 of file coding.cc.

Referenced by fhicl::detail::encode().

38 {
39  static std::string literal_true("true");
40  return literal_true;
41 }
static ps_atom_t literal_true()
Definition: coding.cc:37