icedb  version 0.5.1
Snow particle scattering database API
Functions
anonymous_namespace{shapeIOtextParsers.cpp} Namespace Reference

Internal namespace for the reader parsers. More...

Functions

template<typename Iterator >
bool parse_shapefile_entries (Iterator first, Iterator last, std::vector< float > &v)
 Parses space-separated shapefile entries. More...
 
template<typename OutputIterator , typename Container >
bool print_shapefile_entries (OutputIterator &sink, Container const &v)
 Used in quickly printing shapefile. More...
 
template<typename OutputIterator , typename Container >
bool print_shapefile_pts (OutputIterator &sink, Container const &v)
 

Detailed Description

Internal namespace for the reader parsers.

Function Documentation

◆ parse_shapefile_entries()

template<typename Iterator >
bool anonymous_namespace{shapeIOtextParsers.cpp}::parse_shapefile_entries ( Iterator  first,
Iterator  last,
std::vector< float > &  v 
)

Parses space-separated shapefile entries.

Definition at line 35 of file shapeIOtextParsers.cpp.

Referenced by icedb::Examples::Shapes::readDDSCATtextContents(), and icedb::Examples::Shapes::readRawText().

36  {
37  using qi::double_;
38  using qi::long_;
39  using qi::float_;
40  using qi::phrase_parse;
41  using qi::_1;
42  using ascii::space;
43  using phoenix::push_back;
44 
45  bool r = phrase_parse(first, last,
46 
47  // Begin grammar
48  (
49  // *long_[push_back(phoenix::ref(v), _1)]
50  *float_
51  )
52  ,
53  // End grammar
54 
55  space, v);
56 
57  if (first != last) // fail if we did not get a full match
58  return false;
59  return r;
60  }
Here is the caller graph for this function:

◆ print_shapefile_entries()

template<typename OutputIterator , typename Container >
bool anonymous_namespace{shapeIOtextParsers.cpp}::print_shapefile_entries ( OutputIterator &  sink,
Container const &  v 
)

Used in quickly printing shapefile.

Definition at line 64 of file shapeIOtextParsers.cpp.

Referenced by icedb::Examples::Shapes::writeDDSCAT().

65  {
66  using boost::spirit::karma::long_;
67  using boost::spirit::karma::float_;
68  using boost::spirit::karma::repeat;
69  using boost::spirit::karma::generate;
70  //using boost::spirit::karma::generate_delimited;
71  using boost::spirit::ascii::space;
72 
73  bool r = generate(
74  sink, // destination: output iterator
75  *(
76  //repeat(7)()
77  '\t' << long_ << '\t' << // point id
78  float_ << '\t' << float_ << '\t' << float_ << '\t' << // point coordinates
79  long_ << '\t' << long_ << '\t' << long_ << '\n' // dielectric
80  ),
81  //space, // the delimiter-generator
82  v // the data to output
83  );
84  return r;
85  }
Here is the caller graph for this function:

◆ print_shapefile_pts()

template<typename OutputIterator , typename Container >
bool anonymous_namespace{shapeIOtextParsers.cpp}::print_shapefile_pts ( OutputIterator &  sink,
Container const &  v 
)

Definition at line 88 of file shapeIOtextParsers.cpp.

Referenced by icedb::Examples::Shapes::writeTextRaw().

89  {
90  using boost::spirit::karma::long_;
91  using boost::spirit::karma::float_;
92  using boost::spirit::karma::repeat;
93  using boost::spirit::karma::generate;
94  //using boost::spirit::karma::generate_delimited;
95  using boost::spirit::ascii::space;
96 
97  bool r = generate(
98  sink, // destination: output iterator
99  *(
100  //repeat(7)()
101  float_ << '\t' << float_ << '\t' << float_ << '\n'
102  ),
103  //space, // the delimiter-generator
104  v // the data to output
105  );
106  return r;
107  }
Here is the caller graph for this function: