-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSubCodeList.cpp
More file actions
103 lines (85 loc) · 2.13 KB
/
SubCodeList.cpp
File metadata and controls
103 lines (85 loc) · 2.13 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*
* Argus Open Source
* Software to apply Statistical Disclosure Control techniques
*
* Copyright 2014 Statistics Netherlands
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the European Union Public Licence
* (EUPL) version 1.1, as published by the European Commission.
*
* You can find the text of the EUPL v1.1 on
* https://joinup.ec.europa.eu/software/page/eupl/licence-eupl
*
* This software is distributed on an "AS IS" basis without
* warranties or conditions of any kind, either express or implied.
*/
#include <vector>
#include "SubCodeList.h"
using namespace std;
string CSubCodeList::GetSubCode(long isubcodenum)
{
if (isubcodenum < 0) {
return m_colSubCodeCollection[0];
}
if (isubcodenum > ((int) (m_colSubCodeCollection.size())) - 1) {
return m_colSubCodeCollection[m_colSubCodeCollection.size() - 1];
}
else
{
return m_colSubCodeCollection[isubcodenum];
}
}
void CSubCodeList::FillSubCodes(vector<string> &codes, long *indices)
{
long i;
m_colSubCodeCollection.resize(codes.size());
m_lSubCodeIndex = new long[codes.size()];
for (i= 0; i< ((int) codes.size()); i++)
{
m_colSubCodeCollection[i] = codes[i];
m_lSubCodeIndex[i] = indices[i];
}
m_lNumberOfSubCodes = codes.size();
}
long CSubCodeList::IsInSubCodes(const string &sCode)
{
for (long i = 0; i < ((int) m_colSubCodeCollection.size()); i++) {
if (sCode == m_colSubCodeCollection[i]) {
return i;
}
}
return -1;
}
void CSubCodeList::SetParentCode(const string &code)
{
m_sParentCode = code;
}
string CSubCodeList::GetParentCode()
{
return m_sParentCode;
}
void CSubCodeList::SetSequenceNumber(long num)
{
m_lSequenceNumber = num;
}
long CSubCodeList::GetSequenceNumber()
{
return m_lSequenceNumber;
}
long CSubCodeList::NumberOfSubCodes()
{
return m_lNumberOfSubCodes;
}
long CSubCodeList::GetParentIndex()
{
return m_lParentCodeIndex;
}
void CSubCodeList::SetParentIndex(long Index)
{
m_lParentCodeIndex = Index;
}
long CSubCodeList::GetSubCodeIndex(long i)
{
return m_lSubCodeIndex[i];
}