40 #include "get_ascii.h" 41 #include "AsciiOutput.h" 44 #include "AsciiByte.h" 45 #include "AsciiInt16.h" 46 #include "AsciiUInt16.h" 47 #include "AsciiInt32.h" 48 #include "AsciiUInt32.h" 49 #include "AsciiFloat32.h" 50 #include "AsciiFloat64.h" 53 #include "AsciiArray.h" 54 #include "AsciiStructure.h" 55 #include "AsciiSequence.h" 56 #include "AsciiGrid.h" 58 namespace dap_asciival {
68 get_data_values_as_ascii(DDS *dds, ostream &strm)
70 BESDEBUG(
"ascii",
"In get_data_values_as_ascii; dataset name = " << dds->get_dataset_name() << endl );
71 strm <<
"Dataset: " << dds->get_dataset_name() <<
"\n" ;
73 DDS::Vars_iter i = dds->var_begin();
74 while (i != dds->var_end()) {
76 dynamic_cast<AsciiOutput &>(**i).print_ascii(strm);
82 BESDEBUG(
"ascii",
"Out get_data_values_as_ascii" << endl );
85 DDS *datadds_to_ascii_datadds(DDS *dds)
87 BESDEBUG(
"ascii",
"In datadds_to_ascii_datadds" << endl);
92 DDS *asciidds =
new DDS(dds->get_factory(), dds->get_dataset_name());
94 DDS::Vars_iter i = dds->var_begin();
95 while (i != dds->var_end()) {
96 BaseType *abt = basetype_to_asciitype(*i);
97 asciidds->add_var_nocopy(abt);
108 asciidds->tag_nested_sequences();
115 basetype_to_asciitype( BaseType *bt )
120 return new AsciiByte( dynamic_cast<Byte *>(bt) ) ;
123 return new AsciiInt16( dynamic_cast<Int16 *>(bt) ) ;
126 return new AsciiUInt16( dynamic_cast<UInt16 *>(bt) ) ;
129 return new AsciiInt32( dynamic_cast<Int32 *>(bt) ) ;
132 return new AsciiUInt32( dynamic_cast<UInt32 *>(bt) ) ;
135 return new AsciiFloat32( dynamic_cast<Float32 *>(bt) ) ;
138 return new AsciiFloat64( dynamic_cast<Float64 *>(bt) ) ;
141 return new AsciiStr( dynamic_cast<Str *>(bt) ) ;
144 return new AsciiUrl( dynamic_cast<Url *>(bt) ) ;
147 return new AsciiArray( dynamic_cast<Array *>(bt) ) ;
149 case dods_structure_c:
152 case dods_sequence_c:
156 return new AsciiGrid( dynamic_cast<Grid *>(bt) ) ;
159 throw InternalErr(__FILE__, __LINE__,
"Unknown type");