-
Notifications
You must be signed in to change notification settings - Fork 9
/
initData.cpp
76 lines (63 loc) · 1.48 KB
/
initData.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include "initData.h"
namespace eqEarth
{
// ----------------------------------------------------------------------------
InitData::InitData( )
: _frameDataID( 0 )
, _modelFileName( DEFAULT_MODEL )
, _kmlFileName( "" )
{
}
InitData::~InitData( )
{
setFrameDataID( eq::uint128_t( ));
}
void InitData::setFrameDataID( const eq::uint128_t& id )
{
_frameDataID = id;
}
void InitData::setModelFileName( const std::string &fileName )
{
_modelFileName = fileName;
}
void InitData::setKMLFileName( const std::string &fileName )
{
_kmlFileName = fileName;
}
void InitData::getInstanceData( co::DataOStream& stream )
{
stream << _frameDataID << _modelFileName << _kmlFileName;
}
void InitData::applyInstanceData( co::DataIStream& stream )
{
stream >> _frameDataID >> _modelFileName >> _kmlFileName;
}
bool InitData::parseCommandLine( char **argv, int argc )
{
std::string model = _parseCommandLineParam( argc, argv, "--model" );
if( !model.empty( ))
{
setModelFileName( model );
}
std::string kml = _parseCommandLineParam( argc, argv, "--kml" );
if( !kml.empty( ))
{
setKMLFileName( kml );
}
return true;
}
std::string InitData::_parseCommandLineParam( int argc, char** argv,
std::string param )
{
for ( int i = 1; i < argc; i++ )
{
if( strcmp( argv[i], param.c_str( )) == 0 )
{
++i;
if( i < argc )
return argv[i];
}
}
return "";
}
}