34 #include "config_ff.h"
36 static char rcsid[] not_used =
"$Id$";
41 #include "AttrTable.h"
43 #include "InternalErr.h"
44 #include "dods-datatypes.h"
48 #include "DODS_Time_Factory.h"
51 DODS_Time_Factory::DODS_Time_Factory(DDS &dds,
const string &attribute_name)
57 AttrTable *at = dds.get_attr_table().find_container(attribute_name);
59 throw Error(
string(
"DODS_Time_Factory requires that the ")
60 + attribute_name +
string(
" attribute be present."));
62 string hours_name = at->get_attr(
"hours_variable");
63 string mins_name = at->get_attr(
"minutes_variable");
64 string secs_name = at->get_attr(
"seconds_variable");
65 string gmt = at->get_attr(
"gmt_time");
79 _hours = dds.var(hours_name);
80 if (_hours && !is_integer_type(_hours))
81 throw Error(
"DODS_Time_Factory: The variable used for hours must be an integer.");
83 _minutes = dds.var(mins_name);
84 if (_minutes && !is_integer_type(_minutes))
85 throw Error(
"DODS_Time_Factory: The variable used for minutes must be an integer.");
87 _seconds = dds.var(secs_name);
88 if (_seconds && !(is_integer_type(_seconds) || is_float_type(_seconds)))
89 throw Error(
"DODS_Time_Factory: The variable used for seconds must be an integer.");
95 return DODS_Time(get_integer_value(_hours), get_integer_value(_minutes),
96 get_float_value(_seconds), _gmt);