20 #ifndef _HiRISE_Data_Component_
21 #define _HiRISE_Data_Component_
28 #if defined (INCLUDE_PVL)
47 #define INT_8_TYPE char
53 #define U_INT_8_TYPE unsigned char
59 #define INT_16_TYPE short int
65 #define U_INT_16_TYPE unsigned short int
71 #define INT_32_TYPE int
77 #define U_INT_32_TYPE unsigned int
83 #define INT_64_TYPE long int
89 #define U_INT_64_TYPE unsigned long int
130 static const char*
const
154 #if defined (INCLUDE_CSPICE)
161 static const char*
const
165 static const char*
const
174 static const char*
const
202 const char** names = NULL,
203 unsigned int size = 0,
204 const Index* offsets = NULL,
205 const Index indexed_arrays[][2] = NULL,
267 virtual std::string
id ()
const;
276 virtual const char*
name ()
const = 0;
311 #if defined (INCLUDE_PVL)
354 (std::ostream& stream = std::cout,
bool verbose =
false)
const = 0;
371 std::ostream& stream = std::cout,
int width = 0)
const;
416 std::ostream& stream = std::cout)
const;
632 std::ostream&
operator<<
633 (std::ostream& stream,
const Data_Component& component);
667 std::ostream& stream = std::cout,
int width = 0);
669 #if defined (INCLUDE_PVL)
720 bool case_sensitive =
false,
744 std::vector<std::string>
749 bool case_sensitive =
false,
775 bool case_sensitive =
false,
785 bool case_sensitive =
false,
810 const std::string& value,
811 bool case_sensitive =
false,
958 const std::string& directory,
960 const std::string& extension
991 std::string
bits (
const unsigned int value,
unsigned int count = 0);
1000 unsigned int max_strlen (
const char** strings);
1008 std::string
to_upper (
const std::string& characters);
1022 std::string
shift (std::string lines,
int amount);
1039 std::string
plural (
int count);
1060 (
const unsigned int value,
const unsigned int *array,
int size);
1072 (
const char*
const value,
const char*
const array[],
int size);
#define INT_64_TYPE
Definition: Data_Component.hh:83
#define INT_16_TYPE
Definition: Data_Component.hh:59
#define U_INT_64_TYPE
Definition: Data_Component.hh:89
#define U_INT_8_TYPE
Definition: Data_Component.hh:53
#define U_INT_16_TYPE
Definition: Data_Component.hh:65
#define INT_32_TYPE
Definition: Data_Component.hh:71
#define INT_8_TYPE
Definition: Data_Component.hh:47
#define U_INT_32_TYPE
Definition: Data_Component.hh:77
unsigned char * data() const
A Data_Component provides a common, virtual interface for all HiRISE Observation data blocks.
Definition: Data_Component.hh:124
static const char *const INVALID_UTC_TIME
Definition: Data_Component.hh:175
u_int_16 internet_checksum() const
Calculates the Internet Checksum as per RFC 1071.
Definition: Data_Component.cc:503
static const int HEX
Definition: Data_Component.hh:139
Data_Component & operator=(const Data_Component &component)
Assignment operator.
Definition: Data_Component.cc:232
unsigned int local_data()
Gets the size of the local data storage area.
Definition: Data_Component.hh:556
unsigned int element_location_print_width(Index element) const
Gets the width of the Element location printing fields.
Definition: Data_Component.cc:383
static const int MRO_CLOCK_ID
The ID used by NAIF for specifying the MRO clock to CSPICE routines.
Definition: Data_Component.hh:170
virtual const char * name() const =0
Gets the name of the component.
virtual u_int_32 get(Index element, Index index=0) const
Gets a value from a data Element or array entry of the component.
Definition: Data_Component.cc:286
virtual bool is_valid() const =0
Tests if the component data is valid.
static const char PATHNAME_DELIMITER
Host filesystem pathname delimiter.
Definition: Data_Component.hh:144
virtual std::string id() const
Gets the identification of this component.
Definition: Data_Component.cc:269
std::ostream & print_element(const Index element, int format=DECIMAL, std::ostream &stream=std::cout, int width=0) const
Prints an Element description.
Definition: Data_Component.cc:354
virtual ~Data_Component()
Destructor.
Definition: Data_Component.cc:258
static const int DECIMAL
Format specifier.
Definition: Data_Component.hh:138
virtual idaeim::PVL::Aggregate * PVL() const =0
Produces an exhausitive PVL (Parameter Value Language) rendition of the component contents.
static const char SUBSECONDS_DELIMITER
Delimits subseconds from seconds in clock count representations.
Definition: Data_Component.hh:152
unsigned char * data() const
Gets a pointer to the current component storage.
Definition: Data_Component.hh:546
Data_Component(const char **names=NULL, unsigned int size=0, const Index *offsets=NULL, const Index indexed_arrays[][2]=NULL, Data_Order order=Data_Block::MSB)
Constructs a Data_Component using component specifications.
Definition: Data_Component.cc:179
static const char *const SPICE_METAKERNEL_VARIABLE
The name of the environment variable for the SPICE metakernel pathname.
Definition: Data_Component.hh:162
static const int UTC_SECONDS_PRECISION
UTC seconds precision (digits after the decimal point).
Definition: Data_Component.hh:148
std::ostream & print_element(const Index element, std::ostream &stream) const
Prints an Element description.
Definition: Data_Component.hh:382
Data_Block & attach(void *const block, unsigned int size)
Attaches a new block of data to the component.
Definition: Data_Component.cc:428
static const char *const DEFAULT_SPICE_METAKERNEL
The default SPICE metakernal pathname.
Definition: Data_Component.hh:166
std::ostream & print_element_location(const Index element, std::ostream &stream=std::cout) const
Prints the location of an Element in the component.
Definition: Data_Component.cc:325
virtual std::ostream & print(std::ostream &stream=std::cout, bool verbose=false) const =0
Prints a detailed description of the component structure and contents.
virtual Data_Component & put(const u_int_32 value, Index element, Index index=0)
Puts a value into a data Element or array entry of the component.
Definition: Data_Component.cc:295
unsigned int name_field_width() const
Gets the width of the Element name printing field.
Definition: Data_Component.cc:306
Data_Component & resize(unsigned int size)
Resizes the block of local data storage.
Definition: Data_Component.cc:465
static const int BOOLEAN
Definition: Data_Component.hh:140
static const char *const ID
Class identification name with source code version and date.
Definition: Data_Component.hh:131
static const unsigned int SPACECRAFT_EPOCH
INT_8_TYPE int_8
8-bit integer type.
Definition: Data_Component.hh:50
U_INT_16_TYPE u_int_16
16-bit unsigned integer type.
Definition: Data_Component.hh:68
Parameter_Class_Selection
Selects the class of parameter for PVL_parameter to find.
Definition: Data_Component.hh:675
@ ASSIGNMENT_PARAMETER
Definition: Data_Component.hh:678
@ AGGREGATE_PARAMETER
Definition: Data_Component.hh:676
@ ANY_PARAMETER
Definition: Data_Component.hh:677
string shift(std::string lines, int amount)
Shifts (indents) lines of text by the specified number of spaces.
Definition: Data_Component.cc:1209
string plural(int count)
Gets a pluralization string.
Definition: Data_Component.cc:1238
string bits(const unsigned int value, unsigned int count)
Gets the string representation of a value in binary.
Definition: Data_Component.cc:591
unsigned int max_strlen(const char **strings)
Finds the length of the longest string in the list.
Definition: Data_Component.cc:617
U_INT_8_TYPE u_int_8
8-bit unsigned integer type.
Definition: Data_Component.hh:56
Parameter * PVL_parameter(idaeim::PVL::Aggregate &aggregate, std::string pathname, bool case_sensitive, int skip, Parameter_Class_Selection parameter_class)
Gets a named PVL Parameter in an aggregate.
Definition: Data_Component.cc:651
string hostname()
Gets the name of the host system.
Definition: Data_Component.cc:1109
INT_32_TYPE int_32
32-bit integer type.
Definition: Data_Component.hh:74
PIRL::Data_Block::Index Index
Data_Block element index type.
Definition: Data_Component.hh:95
std::ostream & print_value(u_int_32 value, int format, std::ostream &stream, int width)
Prints a value in a consistent Data_Component format.
Definition: Data_Component.cc:534
U_INT_64_TYPE u_int_64
64-bit unsigned integer type.
Definition: Data_Component.hh:92
double seconds(const std::string &clock_count, Clock_Selector clock)
Converts a clock count representation to time in seconds.
Definition: Data_Component.cc:1021
Clock_Selector
Used to select a clock.
Definition: Data_Component.hh:879
@ HiRISE_Clock
Definition: Data_Component.hh:880
@ MRO_Clock
Definition: Data_Component.hh:881
std::vector< std::string > PVL_values(idaeim::PVL::Aggregate &aggregate, std::string pathname, bool case_sensitive, int skip)
Gets the values of a named PVL Parameter in an aggregate.
Definition: Data_Component.cc:704
string UTC_time(double seconds, unsigned int epoch)
Converts time in seconds to UTC representation.
Definition: Data_Component.cc:859
INT_16_TYPE int_16
16-bit integer type.
Definition: Data_Component.hh:62
string filename(const std::string &pathname)
Gets the filename portion of a pathname.
Definition: Data_Component.cc:1193
u_int_16 Pixel_type
The type of a generic pixel value.
Definition: Data_Component.hh:98
bool file_exists(const std::string &filename)
Tests if a file exists.
Definition: Data_Component.cc:1120
bool member_of(const unsigned int value, const unsigned int *array, int size)
Tests if a value is a member of an array.
Definition: Data_Component.cc:1079
std::string to_upper(const std::string &characters)
Converts all characters of a string to uppercase.
Definition: Data_Component.cc:634
string pathname(const std::string &filename)
Gets a fully qualified pathname for a filename.
Definition: Data_Component.cc:1132
bool PVL_value(idaeim::PVL::Aggregate &aggregate, std::string pathname, unsigned int value, bool case_sensitive, int skip)
Sets the value of a named PVL parameter in an aggregate.
Definition: Data_Component.cc:741
INT_64_TYPE int_64
64-bit integer type.
Definition: Data_Component.hh:86
string clock_count(double seconds, Clock_Selector clock)
Converts time in seconds to clock count representation.
Definition: Data_Component.cc:989