blob: ebf2ff74d531472b23579350869b3ce17dcbb441 (
plain)
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
|
#include <iostream>
#include <cstdlib>
#include <time.h>
#include "samplenamespace.h"
using namespace std;
namespace SampleNamespace
{
OutValue
enumInEnumOut(InValue in)
{
OutValue retval;
switch(in) {
case ZeroIn:
retval = ZeroOut;
break;
case OneIn:
retval = OneOut;
break;
case TwoIn:
retval = TwoOut;
break;
default:
retval = (OutValue) -1;
}
return retval;
}
int
getNumber(Option opt)
{
int retval;
switch(opt) {
case RandomNumber:
retval = rand() % 100;
break;
case UnixTime:
retval = (int) time(0);
break;
default:
retval = 0;
}
return retval;
}
} // namespace SampleNamespace
|