-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclsOutputManager.h
More file actions
100 lines (84 loc) · 3.45 KB
/
clsOutputManager.h
File metadata and controls
100 lines (84 loc) · 3.45 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
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the ig-logger project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Original author: Christian Kaiser <info@invest-tools.com>
*/
#pragma once
#include "clsConfig.h"
#include "clsExcept.h"
#include "clsExecProcess.h"
#include "clsDatabase.h"
#include <wcskip.h>
class clsOutputManager
{
private:
String CreateDirectory(const WCValSList<String>& DirectoryParts);
protected:
const clsConfigOfLocation& _Location;
String _sBaseDirectory;
virtual LPCTSTR pszSectionName() = 0;
virtual bool bHasCommonBaseDirectory() = 0;
void UploadFile(const clsConfigOfInstallation& Installation, const String& sFilename);
virtual void Initialize(const clsConfigOfInstallation& Installation, const clsLocalNetID& ID);
public:
clsOutputManager(const clsConfigOfLocation& Location);
virtual ~clsOutputManager()
{
}
virtual bool Append(const clsDeviceDataList& List, const clsErrorList& ErrorList, bool bHistorical, bool bForceGraphic) = 0;
virtual void DailyMaintenance(const clsLocalNetID& /* ID */)
{
}
};
class clsRRDTOOL
: public clsOutputManager
, private clsExecNotifier
{
private:
virtual LPCTSTR pszSectionName()
{
return("RRDTool");
}
virtual bool bHasCommonBaseDirectory()
{
return(false);
}
bool ExecRRD(const String& sCmdLine);
String sDatabaseName(const clsSYSTEMTIME& ST, bool bHistorical);
virtual void Initialize(const clsConfigOfInstallation& Installation, const clsLocalNetID& ID);
void CreateDatabase(const clsConfigOfInstallation& Installation, const clsSYSTEMTIME& ST, const String& sFilename, bool bHistorical);
void CreateGraph(const clsConfigOfInstallation& Installation, const clsSYSTEMTIME& ST, const clsDataItemList& List, const clsErrorList& ErrorList, bool bHistorical);
void AppendData(const clsConfigOfInstallation& Installation, const clsDataList& List, const clsErrorList& ErrorList, bool bHistorical, bool bForceGraphic);
virtual void Notify(const String& s);
public:
clsRRDTOOL(const clsConfigOfLocation& Location);
virtual bool Append(const clsDeviceDataList& List, const clsErrorList& ErrorList, bool bHistorical, bool bForceGraphic);
};
class clsSQLite
: public clsOutputManager
{
private:
clsDatabase* _pDatabase;
virtual LPCTSTR pszSectionName()
{
return("SQLite");
}
virtual bool bHasCommonBaseDirectory()
{
return(true);
}
String sTableName(const clsLocalNetID& ID);
virtual void Initialize(const clsConfigOfInstallation& Installation, const clsLocalNetID& ID);
void AppendData(const clsConfigOfInstallation& Installation, const clsLocalNetID& ID, const clsDataList& List, const clsErrorList& ErrorList);
public:
clsSQLite(const clsConfigOfLocation& Location);
~clsSQLite();
virtual bool Append(const clsDeviceDataList& List, const clsErrorList& ErrorList, bool bHistorical, bool bForceGraphic);
virtual void DailyMaintenance(const clsLocalNetID& ID);
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */