1 | /*
|
---|
2 | ###############################################################################
|
---|
3 | #
|
---|
4 | # Temboo Arduino library
|
---|
5 | #
|
---|
6 | # Copyright 2014, Temboo Inc.
|
---|
7 | #
|
---|
8 | # Licensed under the Apache License, Version 2.0 (the "License");
|
---|
9 | # you may not use this file except in compliance with the License.
|
---|
10 | # You may obtain a copy of the License at
|
---|
11 | #
|
---|
12 | # http://www.apache.org/licenses/LICENSE-2.0
|
---|
13 | #
|
---|
14 | # Unless required by applicable law or agreed to in writing,
|
---|
15 | # software distributed under the License is distributed on an
|
---|
16 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
---|
17 | # either express or implied. See the License for the specific
|
---|
18 | # language governing permissions and limitations under the License.
|
---|
19 | #
|
---|
20 | ###############################################################################
|
---|
21 | */
|
---|
22 |
|
---|
23 | #ifndef DATAFORMATTER_H_
|
---|
24 | #define DATAFORMATTER_H_
|
---|
25 | #include "TembooGlobal.h"
|
---|
26 | #include "ChoreoInputSet.h"
|
---|
27 | #include "ChoreoOutputSet.h"
|
---|
28 | #include "ChoreoPreset.h"
|
---|
29 | #include "ChoreoInputFormatter.h"
|
---|
30 | #include "ChoreoOutputFormatter.h"
|
---|
31 | #include "ChoreoPresetFormatter.h"
|
---|
32 |
|
---|
33 |
|
---|
34 | class DataFormatter {
|
---|
35 |
|
---|
36 | public:
|
---|
37 | DataFormatter(const ChoreoInputSet* inputSet, const ChoreoOutputSet* outputSet, const ChoreoPreset* preset);
|
---|
38 | bool hasNext();
|
---|
39 | char next();
|
---|
40 | void reset();
|
---|
41 |
|
---|
42 | private:
|
---|
43 | const ChoreoInputSet* m_inputSet;
|
---|
44 | const ChoreoOutputSet* m_outputSet;
|
---|
45 | const ChoreoPreset* m_preset;
|
---|
46 |
|
---|
47 | ChoreoInputFormatter m_inputFormatter;
|
---|
48 | ChoreoOutputFormatter m_outputFormatter;
|
---|
49 | ChoreoPresetFormatter m_presetFormatter;
|
---|
50 |
|
---|
51 | enum State {
|
---|
52 | DATA_START,
|
---|
53 | FORMATTING_INPUTS,
|
---|
54 | FORMATTING_OUTPUTS,
|
---|
55 | FORMATTING_PRESET,
|
---|
56 | FORMATTING_EMPTY,
|
---|
57 | DATA_END
|
---|
58 | };
|
---|
59 |
|
---|
60 | State m_nextState;
|
---|
61 |
|
---|
62 | };
|
---|
63 | #endif
|
---|