COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
print_utils.h
Go to the documentation of this file.
1 /********************************************************************
2 * Copyright (C) 2015 by Interstel Technologies, Inc.
3 * and Hawaii Space Flight Laboratory.
4 *
5 * This file is part of the COSMOS/core that is the central
6 * module for COSMOS. For more information on COSMOS go to
7 * <http://cosmos-project.com>
8 *
9 * The COSMOS/core software is licenced under the
10 * GNU Lesser General Public License (LGPL) version 3 licence.
11 *
12 * You should have received a copy of the
13 * GNU Lesser General Public License
14 * If not, go to <http://www.gnu.org/licenses/>
15 *
16 * COSMOS/core is free software: you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public License
18 * as published by the Free Software Foundation, either version 3 of
19 * the License, or (at your option) any later version.
20 *
21 * COSMOS/core is distributed in the hope that it will be useful, but
22 * WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
25 *
26 * Refer to the "licences" folder for further information on the
27 * condititons and terms to use this software.
28 ********************************************************************/
29 
30 
31 #ifndef _COSMOS_PRINT_UTILS
32 #define _COSMOS_PRINT_UTILS
33 
34 // COSMOS Library for Printing Vector and stuff like that to the stream
35 
36 // v1.0 : 2014-10-05
37 // library created
38 
39 //---------------------------------------------------------------
40 // Print class
41 #include "support/configCosmos.h"
42 #include "math/mathlib.h"
43 
44 #include <iostream> // std::cout
45 #include <string> // string
46 #include <sstream> // std::ostringstream
47 
48 // TODO: remove the dependency of mathlib later, change rvector to vector?
49 
55 
59 
61 {
62 
63 private:
64 
65 public:
66 
67  PrintUtils();
68 
69  //main functions
70  //-------------------------------------------------------------
71  // print functions to help visualize the vectors and other data
72 
73  // main function
74  // 20150818JC: Fixed mismatched prototype to include field width. Default value in cpp
75  //void vector(string text_prefix, rvector v, double scale, string text_suffix, int precision);
76  void vector(string prefix, rvector v, double scale, string suffix, int precision, int fieldwidth);
77 
78  void vector(rvector v);
79  //void vector(rvector v, int precision);
80  void vector(string prefix, rvector v);
81  //void vector(string vector_name, rvector v, int precision);
82  void vector(string vector_name, rvector v, string suffix);
83  void vector(string prefix, rvector v, string suffix, int precision);
84 
85  void vectorAndMag(string vector_name, rvector v);
86  void vectorAndMag(string vector_name, rvector v, string suffix);
87 
88 
89  // void vectorScaled(string vector_name, rvector v, double scale, int precision);
90  // void vectorScaled(string vector_name, quaternion q, double scale, int precision);
91 
92  // split vector
93  // void vector(string vector_name, double a, double b, double c, string units);
94  // void vector(string vector_name, double a, double b, double c, string units, int precision);
95  // void vector(string vector_name, double a, double b, double c, double d, string units);
96 
97 
98  void vector_endl(rvector v,
99  double factor,
100  string units,
101  int precision);
102 
103  void vector2(string name_v1, rvector v1, string name_v2, rvector v2);
104  void vector2(string name_v1, rvector v1, string name_v2, rvector v2, int precision);
105  void endline();
106 
107  // quaternions
108  string quat(string prefix, quaternion q, string suffix, int precision, int fieldwidth);
109  string quat(quaternion q);
110  void quat(quaternion q, int precision);
111  void quat(string prefix, quaternion q);
112  void quat(string prefix, quaternion q, int precision);
113  void quat(string prefix, quaternion q, string suffix);
114  void quat(string prefix, quaternion q, string suffix, int precision);
115 
116  // control flags
117  bool printOn; // to control printing
120  double scale;
121  string prefix;
122  string suffix;
123  string delimiter;
126  string fullMessage;
127 
128  // reset to default values
129  void reset();
130 
131 
132  void text(string text);
133 
134  // scalar
135  void scalar(string prefix, double s, string suffix);
136  void scalar(string prefix, double s, double scale, string suffix, int precision, int fieldwidth);
137  void scalar(double s, string suffix);
138  void scalar(string prefix, double s);
139  void scalar(double s);
140  // TODO: add void scalar(double s, double precision);
141 
142 };
143 
145 
146 
147 #endif //_COSMOS_PRINT_UTILS
148 
bool delimiter_flag
Definition: print_utils.h:124
void reset()
Definition: print_utils.cpp:44
string prefix
Definition: print_utils.h:121
double scale
Definition: print_utils.h:120
Definition: print_utils.h:60
string delimiter
Definition: print_utils.h:123
void vectorAndMag(string vector_name, rvector v)
Definition: print_utils.cpp:397
3 element generic row vector
Definition: vector.h:53
string fullMessage
Definition: print_utils.h:126
bool printOn
Definition: print_utils.h:117
void vector_endl(rvector v, double factor, string units, int precision)
Quaternion, scalar last, using x, y, z.
Definition: vector.h:402
string quat(string prefix, quaternion q, string suffix, int precision, int fieldwidth)
Definition: print_utils.cpp:473
void vector(string prefix, rvector v, double scale, string suffix, int precision, int fieldwidth)
Definition: print_utils.cpp:85
bool use_brackets
Definition: print_utils.h:125
void scalar(string prefix, double s, string suffix)
Definition: print_utils.cpp:279
int precision
Definition: print_utils.h:118
void endline()
Definition: print_utils.cpp:606
PrintUtils()
Definition: print_utils.cpp:39
Headers and definitions common to all COSMOS.
void vector2(string name_v1, rvector v1, string name_v2, rvector v2)
Definition: print_utils.cpp:377
void text(string text)
Definition: print_utils.cpp:59
mathlib include file
int fieldwidth
Definition: print_utils.h:119
string suffix
Definition: print_utils.h:122