CTlib
Public Member Functions | Protected Member Functions | List of all members
CTlib.CThttp_HttpClient Class Reference

Child class of CThttp_base; uses HttpClient to perform asynchronous HTTP PUT. More...

Inheritance diagram for CTlib.CThttp_HttpClient:
CTlib.CThttp_base CTlib.CTwriter

Public Member Functions

 CThttp_HttpClient (String baseCTOutputFolderI, int numBlocksPerSegmentI, bool bOutputTimesAreMillisI, bool bPackI, bool bZipI, String ctWebHostI="http://localhost:8000")
 Constructor. More...
 
override void close ()
 Close the source.
 
- Public Member Functions inherited from CTlib.CThttp_base
 CThttp_base (String baseCTOutputFolderI, int numBlocksPerSegmentI, bool bOutputTimesAreMillisI, bool bPackI, bool bZipI, String ctWebHostI)
 Constructor. More...
 
void login (String userI, String pwI)
 Create user credential for all subsequent HTTP PUT operations using the given username and password. More...
 
- Public Member Functions inherited from CTlib.CTwriter
 CTwriter (String baseCTOutputFolderI, int numBlocksPerSegmentI, int numSegmentsToKeepI, bool bOutputTimesAreMillisI, bool bPackI, bool bZipI, bool bDeleteOldDataAtStartupI, bool bVerifyOutputFolderI=true)
 Constructor. More...
 
String getBaseCTOutputFolder ()
 Get baseCTOutputFolder. More...
 
void UseTmpFileForZipData (bool bUseTmpZipFilesI)
 If writing output ZIP files, should we write data first to a temporary file (".tmp") and then rename this to the final ".zip" file? If false, we write directly to the output ZIP file using (what is intended to be) a quick stream operation; this has the possible advantage that an extra intermediary ".tmp" file isn't created temporarily. More...
 
void putData (string[] channamesI, double[] dataI)
 Store an additional double data point in each of the specified channels. More...
 
void putData (string[] channamesI, float[] dataI)
 Store an additional single-precision float data point in each of the specified channels. More...
 
void putData (string channameI, String dataI)
 Store a new string in the given channel. More...
 
void putData (string channameI, double dataI)
 Store a double-precision float data value for the given channel. More...
 
void putData (string channameI, float dataI)
 Store a single-precision float data value for the given channel. More...
 
void putData (string channameI, long dataI)
 Store a long integer data value for the given channel. More...
 
void putData (string channameI, int dataI)
 Store an integer data value for the given channel. More...
 
void putData (string channameI, short dataI)
 Store a short integer data value for the given channel. More...
 
void putData (string channameI, char dataI)
 Store a character data value for the given channel. More...
 
void putData (string channameI, byte[] dataI)
 Store binary data array for the given channel. More...
 
long setTime ()
 Set time for subsequent putData(). This method simply calls setTime(<current_time_millis>). More...
 
void setTime (long timeI)
 Set time for subsequent putData(). To switch back to automatic timestamp mode, call this method with the argument equal to -1. More...
 
void setTime (double timeI)
 Set time for subsequent putData(). To switch back to automatic timestamp mode, call this method with the argument equal to -1.0. More...
 
void setAsync (bool bAsyncI)
 Specify whether flushes should be executed asynchronously. More...
 
void flush ()
 Write out all data that has been queued up for this block.
 

Protected Member Functions

override void writeToStream (String outputDirI, String chanNameI, byte[] dataI)
 Write data to the channel using HTTP PUT. More...
 

Additional Inherited Members

- Protected Attributes inherited from CTlib.CThttp_base
String ctWebHost = ""
 The web host data will be PUT to; for example, "http://localhost:8000" More...
 
NetworkCredential credential = null
 Username/password credentials for logging into the server. More...
 
bool bCredentialsChanged = false
 Flag to indicate that username/password credentials have changed. More...
 
String urlStr = ""
 The URL used for HTTP PUT. More...
 

Detailed Description

Child class of CThttp_base; uses HttpClient to perform asynchronous HTTP PUT.

CThttp_HttpClient

This class has been tested and works, but is still somewhat "experimental"; for example, the method used in closeHttpClient() to wait for pending requests before closing the connection is kludgey (there's probably a better way to do this).

Constructor & Destructor Documentation

◆ CThttp_HttpClient()

CTlib.CThttp_HttpClient.CThttp_HttpClient ( String  baseCTOutputFolderI,
int  numBlocksPerSegmentI,
bool  bOutputTimesAreMillisI,
bool  bPackI,
bool  bZipI,
String  ctWebHostI = "http://localhost:8000" 
)
inline

Constructor.

Calls the constructor in the base class.

Parameters
baseCTOutputFolderIThe output source name along with optional additional sub-directory layers. Should be a relative folder path, since the absolute location where data will be written is determined by the HTTP server.
numBlocksPerSegmentINumber of blocks per segment in the source folder hierarchy. Use 0 to not include a segment layer.
bOutputTimesAreMillisIOutput times should be in milliseconds? Needed if blocks are written (i.e., flush() is called) at a rate greater than 1Hz.
bPackIPack data at the block folder level? Packed data times are linearly interpolated from the block start time to the time of the final datapoint in the packed channel.
bZipIZIP data at the block folder level?
ctWebHostIOptional argument; this is the web host data will be PUT to.

Member Function Documentation

◆ writeToStream()

override void CTlib.CThttp_HttpClient.writeToStream ( String  outputDirI,
String  chanNameI,
byte []  dataI 
)
inlineprotectedvirtual

Write data to the channel using HTTP PUT.

Parameters
outputDirIWhere the given data should be put on the server.
chanNameIChannel name.
dataIThe data to PUT.

Reimplemented from CTlib.CThttp_base.


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