libStatGen Software
1
Loading...
Searching...
No Matches
PhoneHome.h
1
/*
2
* Copyright (C) 2013 Regents of the University of Michigan
3
*
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, either version 3 of the License, or
7
* (at your option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#ifndef __PHONEHOME_H__
19
#define __PHONEHOME_H__
20
21
#include <string>
22
#include "StringBasics.h"
23
24
25
// By default, CompletionStatus PhoneHome is disabled.
26
// To enable it:
27
// 1) call "enableCompletionStatus"
28
// 2) call checkVersion
29
// 3) call completionStatus with the program name passed in
30
//
31
class
PhoneHome
32
{
33
public
:
34
// Public method that can be set to control the thinning of version checks.
35
static
int
allThinning;
36
37
// Enable Completion Status PhoneHome, it is disabled by default.
38
// It can also be enabled by:
39
// * calling checkVersion
40
// * calling completionStatus with the program name passed in
41
// Program name must be specified in order to log completionStatus
42
static
void
enableCompletionStatus(
const
char
* programName = NULL);
43
44
// Disable Completion Status PhoneHome. (It is already disabled by default.)
45
static
void
disableCompletionStatus();
46
47
// Check the version, printing a message if a newer version is available.
48
// Enables CompletionStatus PhoneHome
49
// Returns false if there is a new version available, otherwise true.
50
static
bool
checkVersion(
const
char
* programName,
51
const
char
* version,
52
const
char
* params = NULL);
53
54
// If completionStatus is enabled, send the completion status.
55
// completionStatus is enabled if:
56
// 1) enableCompletionStatus was called
57
// 2) checkVersion was called
58
// 3) programName is passed in
59
// ProgramName is ignored if it has previously been set.
60
static
void
completionStatus(
const
char
* status,
61
const
char
* programName = NULL);
62
63
static
void
setURL(
const
char
* url);
64
static
void
resetURL();
65
66
protected
:
67
private
:
68
static
void
add(
const
char
* name,
const
char
* val);
69
static
bool
connect();
70
71
static
bool
ourEnableCompletionStatus;
72
static
std::string ourBaseURL;
73
static
std::string ourURL;
74
static
char
ourPrefixChar;
75
static
int
ourNumber;
76
static
String
ourToolName;
77
78
static
String
ourReturnString;
79
};
80
81
#endif
PhoneHome
Definition
PhoneHome.h:32
String
Definition
StringBasics.h:39
general
PhoneHome.h
Generated by
1.9.8