-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataSource.cpp
More file actions
executable file
·64 lines (54 loc) · 979 Bytes
/
DataSource.cpp
File metadata and controls
executable file
·64 lines (54 loc) · 979 Bytes
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
/*
* DataSource.cpp
*
* Created on: 15 Apr 2014
* Author: lester
*/
#include "DataSource.h"
enum
{
FIELD_TYPE, //
FIELD_CONNECTION_TYPE,
FIELD_DESCRIPTION,
FIELD_NODES,
ELEMENT_A
};
static struct _configurable_descriptor desc[] =
{
{ "type", FIELD_TYPE, TYPE_STRING },
{ "pci", ELEMENT_A, TYPE_OBJECT } };
struct _configurable_descriptor_list desc_list
{ sizeof(desc) / sizeof(*desc), desc };
DataSource::DataSource()
{
// TODO Auto-generated constructor stub
}
DataSource::~DataSource()
{
// TODO Auto-generated destructor stub
}
const struct _configurable_descriptor_list& DataSource::getDescriptor()
{
return desc_list;
}
int DataSource::setValue(unsigned id, double d)
{
if (id == FIELD_DESCRIPTION)
{
// check value
}
else
{
return -1; // unknown value or invalid type
}
return 0;
}
Configurable* DataSource::getNewObject(int type)
{
if (type == ELEMENT_A)
{
list.push_back(A());
return &(*list.rbegin());
}
return nullptr;
}