My Project
OSgLWriter.h
Go to the documentation of this file.
1/* $Id: OSglWriter.h 2698 2009-06-09 04:14:07Z kmartin $ */
18#ifndef OSgLWRITER_H
19#define OSgLWRITER_H
20
21#include "OSGeneral.h"
22#include "OSiLWriter.h"
23#include "OSInstance.h"
24#include "OSGeneral.h"
25#include "OSParameters.h"
26#include "OSBase64.h"
27#include "OSMathUtil.h"
28
29#include <string>
30#include <sstream>
31
40/*
41std::string writeIntVectorData(IntVector *v, bool addWhiteSpace, bool writeBase64)
42{
43 ostringstream outStr;
44 int mult, incr;
45
46 if (v->numberOfEl > 0)
47 {
48 if(writeBase64 == false)
49 {
50 for(int i = 0; i <= v->numberOfEl;)
51 {
52 getMultIncr(&(v->el[i]), &mult, &incr, (v->numberOfEl) - i, 1);
53 if (mult == 1)
54 outStr << "<el>" ;
55 else if (incr == 1)
56 outStr << "<el mult=\"" << mult << "\">";
57 else
58 outStr << "<el mult=\"" << mult << "\" incr=\"" << incr << "\">";
59 outStr << v->el[i];
60 outStr << "</el>" ;
61 if(addWhiteSpace == true) outStr << endl;
62 i += mult;
63 }
64 }
65 else
66 {
67 outStr << "<base64BinaryData sizeOf=\"" << sizeof(int) << "\">" ;
68 outStr << Base64::encodeb64( (char*)v->el, (v->numberOfEl)*sizeof(int) );
69 outStr << "</base64BinaryData>" ;
70 if(addWhiteSpace == true) outStr << endl;
71 }
72 }
73 return outStr.str();
74}// end writeIntVectorData
75*/
76
85/*
86std::string writeDblVectorData(DoubleVector *v, bool addWhiteSpace, bool writeBase64)
87{
88 ostringstream outStr;
89 int mult, incr;
90
91 if (v->numberOfEl > 0)
92 {
93 if(writeBase64 == false)
94 {
95 for(int i = 0; i <= v->numberOfEl;)
96 {
97 mult = getMult(&(v->el[i]), (v->numberOfEl) - i);
98 if (mult == 1)
99 outStr << "<el>" ;
100 else
101 outStr << "<el mult=\"" << mult << "\">";
102 outStr << os_dtoa_format(v->el[i] );
103 outStr << "</el>" ;
104 if(addWhiteSpace == true) outStr << endl;
105 i += mult;
106 }
107 }
108 else
109 {
110 outStr << "<base64BinaryData sizeOf=\"" << sizeof(double) << "\">" ;
111 outStr << Base64::encodeb64( (char*)v->el, (v->numberOfEl)*sizeof(double) );
112 outStr << "</base64BinaryData>" ;
113 if(addWhiteSpace == true) outStr << endl;
114 }
115 }
116 return outStr.str();
117}// end writeDblVectorData
118*/
119
128/*
129std::string writeBasisStatus(BasisStatus *bs, bool addWhiteSpace, bool writeBase64)
130{
131 ostringstream outStr;
132
133 if (bs->basic != NULL && bs->basic->numberOfEl > 0)
134 {
135 outStr << "<basic numberOfEl=\"" << bs->basic->numberOfEl << "\">";
136 if(addWhiteSpace == true) outStr << endl;
137 outStr << writeIntVectorData(bs->basic, addWhiteSpace, writeBase64);
138 outStr << "</basic>";
139 if(addWhiteSpace == true) outStr << endl;
140 }
141
142 if (bs->atLower != NULL && bs->atLower->numberOfEl > 0)
143 {
144 outStr << "<basic numberOfEl=\"" << bs->basic->numberOfEl << "\">";
145 if(addWhiteSpace == true) outStr << endl;
146 outStr << writeIntVectorData(bs->atLower, addWhiteSpace, writeBase64);
147 outStr << "</unknown>";
148 if(addWhiteSpace == true) outStr << endl;
149 }
150
151 if (bs->atUpper != NULL && bs->atUpper->numberOfEl > 0)
152 {
153 outStr << "<basic numberOfEl=\"" << bs->basic->numberOfEl << "\">";
154 if(addWhiteSpace == true) outStr << endl;
155 outStr << writeIntVectorData(bs->atUpper, addWhiteSpace, writeBase64);
156 outStr << "</unknown>";
157 if(addWhiteSpace == true) outStr << endl;
158 }
159
160 if (bs->free != NULL && bs->free->numberOfEl > 0)
161 {
162 outStr << "<basic numberOfEl=\"" << bs->basic->numberOfEl << "\">";
163 if(addWhiteSpace == true) outStr << endl;
164 outStr << writeIntVectorData(bs->free, addWhiteSpace, writeBase64);
165 outStr << "</unknown>";
166 if(addWhiteSpace == true) outStr << endl;
167 }
168
169 if (bs->superbasic != NULL && bs->superbasic->numberOfEl > 0)
170 {
171 outStr << "<superbasic numberOfEl=\"" << bs->basic->numberOfEl << "\">";
172 if(addWhiteSpace == true) outStr << endl;
173 outStr << writeIntVectorData(bs->superbasic, addWhiteSpace, writeBase64);
174 outStr << "</unknown>";
175 if(addWhiteSpace == true) outStr << endl;
176 }
177
178 if (bs->unknown != NULL && bs->unknown->numberOfEl > 0)
179 {
180 outStr << "<unknown numberOfEl=\"" << bs->basic->numberOfEl << "\">";
181 if(addWhiteSpace == true) outStr << endl;
182 outStr << writeIntVectorData(bs->unknown, addWhiteSpace, writeBase64);
183 outStr << "</unknown>";
184 if(addWhiteSpace == true) outStr << endl;
185 }
186
187 return outStr.str();
188}// end writeDblVectorData
189*/
190
199std::string writeIntVectorData(IntVector *v, bool addWhiteSpace, bool writeBase64);
200
201
208std::string writeGeneralFileHeader(GeneralFileHeader *v, bool addWhiteSpace);
209
218std::string writeOtherOptionOrResultEnumeration(OtherOptionOrResultEnumeration *e, bool addWhiteSpace, bool writeBase64);
219
220
229std::string writeDblVectorData(DoubleVector *v, bool addWhiteSpace, bool writeBase64);
230
231
240std::string writeBasisStatus(BasisStatus *bs, bool addWhiteSpace, bool writeBase64);
241
242#endif
std::string writeGeneralFileHeader(GeneralFileHeader *v, bool addWhiteSpace)
Take a GeneralFileHeader object and write a string that validates against the OSgL schema.
std::string writeIntVectorData(IntVector *v, bool addWhiteSpace, bool writeBase64)
Take an IntVector object and write a string that validates against the OSgL schema.
std::string writeDblVectorData(DoubleVector *v, bool addWhiteSpace, bool writeBase64)
Take a DoubleVector object and write a string that validates against the OSgL schema.
std::string writeOtherOptionOrResultEnumeration(OtherOptionOrResultEnumeration *e, bool addWhiteSpace, bool writeBase64)
Take an OtherOptionOrResultEnumeration object and write a string that validates against the OSgL sche...
std::string writeBasisStatus(BasisStatus *bs, bool addWhiteSpace, bool writeBase64)
Take a BasisStatus object and write a string that validates against the OSgL schema.
a data structure to represent an LP basis on both input and output
Definition OSGeneral.h:646
a double vector data structure
Definition OSGeneral.h:610
a data structure that holds general information about files that conform to one of the OSxL schemas
Definition OSGeneral.h:33
an integer Vector data structure
Definition OSGeneral.h:470
This file defines the OSInstance class along with its supporting classes.