libStatGen Software 1
Loading...
Searching...
No Matches
PhoneHome Class Reference

Static Public Member Functions

static void enableCompletionStatus (const char *programName=NULL)
 
static void disableCompletionStatus ()
 
static bool checkVersion (const char *programName, const char *version, const char *params=NULL)
 
static void completionStatus (const char *status, const char *programName=NULL)
 
static void setURL (const char *url)
 
static void resetURL ()
 

Static Public Attributes

static int allThinning = 50
 

Detailed Description

Definition at line 31 of file PhoneHome.h.

Member Function Documentation

◆ checkVersion()

bool PhoneHome::checkVersion ( const char *  programName,
const char *  version,
const char *  params = NULL 
)
static

Definition at line 51 of file PhoneHome.cpp.

53{
54 enableCompletionStatus();
55 add("pgm", programName);
56 add("vsn", version);
57 add("args", params);
58
59 connect();
60
61 // Look for this program in the returned string.
62 int start = ourReturnString.Find(ourToolName+"\t");
63 if(start < 0)
64 {
65 // Parse the toolName, and check for the program name
66 // just up to a ':'
67 int colStart = ourToolName.FastFindChar(':');
68 if(colStart >= 0)
69 {
70 ourToolName.SetLength(colStart);
71 start = ourReturnString.Find(ourToolName+"\t");
72 }
73 }
74
75 if(start < 0)
76 {
77 // This program name was not found in the version file,
78 // so it is a program for which version is not tracked,
79 // just return true.
80 return(true);
81 }
82
83 // Found this program, so extract the version.
84 start += ourToolName.Length();
85 while((start < ourReturnString.Length()) &&
86 isspace(ourReturnString[start]))
87 {
88 // Consume whitespace
89 ++start;
90 }
91
92 // Start now contains the position of the start of the version
93 String thisVersion = version;
94 String latestVersion;
95 int end = start;
96 while((end < ourReturnString.Length()) &&
97 !isspace(ourReturnString[end]))
98 {
99 latestVersion += ourReturnString[end];
100 ++end;
101 }
102
103 // std::cerr << "latest version = " << latestVersion << "\nthis version = " << thisVersion.c_str() << "\n";
104
105 if(latestVersion.FastCompare(thisVersion) > 0)
106 {
107 std::cerr << "\n**************************************************************************************\n"
108 << "A new version, " << latestVersion
109 << ", of " << ourToolName
110 << " is available (currently running "
111 << thisVersion.c_str() << ")"
112 << "\n**************************************************************************************\n\n";
113 return(false);
114 }
115 return(true);
116}

◆ completionStatus()

void PhoneHome::completionStatus ( const char *  status,
const char *  programName = NULL 
)
static

Definition at line 118 of file PhoneHome.cpp.

119{
120 if(programName != NULL)
121 {
122 add("pgm", programName);
123 enableCompletionStatus();
124 }
125 if(ourEnableCompletionStatus)
126 {
127 add("status", status);
128 connect();
129 }
130}

◆ disableCompletionStatus()

void PhoneHome::disableCompletionStatus ( )
static

Definition at line 45 of file PhoneHome.cpp.

46{
47 ourEnableCompletionStatus = false;
48}

◆ enableCompletionStatus()

void PhoneHome::enableCompletionStatus ( const char *  programName = NULL)
static

Definition at line 35 of file PhoneHome.cpp.

36{
37 if(programName != NULL)
38 {
39 add("pgm", programName);
40 }
41 ourEnableCompletionStatus = true;
42}

◆ resetURL()

void PhoneHome::resetURL ( )
static

Definition at line 133 of file PhoneHome.cpp.

134{
135 ourURL = ourBaseURL;
136 ourPrefixChar = '?';
137}

Member Data Documentation

◆ allThinning

int PhoneHome::allThinning = 50
static

Definition at line 35 of file PhoneHome.h.


The documentation for this class was generated from the following files: