Qore Programming Language Reference Manual  1.10.0
Pseudo_QC_Int.dox.h
1 
3 namespace Qore {
5 /***/
6 class <int> : public <value> {
7 
8 public:
10 
24 int abs();
25 
26 public:
28 
45 
46 public:
48 
65 
66 public:
68 
94 string format(string fmt);
95 
96 public:
98 
122 string format(int prec = 2, string decimal_sep = ".", string thousands_sep = "");
123 
124 public:
126 
137 bool intp();
138 
139 public:
141 
153 int sign();
154 
155 public:
157 
168 bool strp();
169 
170 public:
172 
207 string toBase(int base = 10);
208 
209 public:
211 
225 string toUnicode();
226 
227 public:
229 
243 int typeCode();
244 
245 public:
247 
261 bool val();
262 };
263 }
Methods in this pseudo-class can be executed on integer values.
Definition: Pseudo_QC_Int.dox.h:6
string toBase(int base=10)
Converts the integer to a different base (and returns it as a string).
int abs()
Returns the absolute value of the number.
int typeCode()
Returns Qore::NT_INT.
bool intp()
Returns True by default.
string format(string fmt)
Returns a formatted string of the integer according to the format argument.
string format(int prec=2, string decimal_sep=".", string thousands_sep="")
Returns a formatted string of the integer according to format arguments.
binary encodeMsb(int size=4)
returns a binary object with the integer encoded in the given number of bytes in most significant byt...
binary encodeLsb(int size=4)
returns a binary object with the integer encoded in the given number of bytes in least significant by...
int sign()
Returns -1 if the number is negative, 0 if it is zero, or 1 if it is positive.
bool strp()
Returns True because integer values can be converted to strings.
string toUnicode()
Returns a single character string in UTF-8 encoding for the integer value treated as a unicode value.
bool val()
Returns True if the int is non-zero, False if zero.
Methods in this pseudo-class are available to be executed on any value type (even NOTHING); this is t...
Definition: Pseudo_QC_All.dox.h:6
int size()
Returns zero; this method will be reimplemented in container types where it may return a non-zero val...
binary binary()
Always returns an empty binary object (of zero length)
main Qore-language namespace
Definition: Pseudo_QC_All.dox.h:3
_provider_pipeline.html#aab215689013692614b151827bb7f2485">submit (AbstractDataProviderBulkRecordInterface i)  Submits data for processing.
   submit (AbstractDataProviderRecordIterator i)  Submits data for processing.
   submit (auto _data)  Submits data for processing.
   submitData (AbstractIterator i)  Submits data for processing.
   waitDone ()  Waits for all queues to have processed remaining data. More...
 

Protected Member Functions

Counter cnt ()
 Thread counter.
 
Mutex lck ()
 Atomic lock.
 
Sequence seq (1)
 Pipeline ID sequence generator.
 

Protected Attributes

bool abort_flag
 Abort flag.
 
*code debug_log
 Debug log closure; takes a single format string and then arguments for format placeholders.
 
bool do_bulk = True
 Bulk flag. More...
 
list< hash< ExceptionInfo > > error_list
 list of exceptions in pipelines
 
*code error_log
 Error log closure; takes a single format string and then arguments for format placeholders.
 
*code info_log
 Info log closure; takes a single format string and then arguments for format placeholders.
 
bool locked = False
 Locked flag.
 
string name
 A descriptive name for logging purposes.
 
hash< string, PipelineQueuepmap
 Hash of queues keyed by queue ID.
 
int record_count = 0
 Record count.
 
date start_time
 run start time
 
bool stop_flag
 Stop flag.
 
date stop_time
 run stop time (set in waitDone())
 
*code thread_callback
 a closure or call reference for setting thread-local data in new pipeline queue threads
 

Private Member Functions

 checkLockedIntern ()
 Throws an exception if the pipeline is locked. More...
 
 checkSubmitIntern ()
 Throws an exception if the pipeline cannot be used; locks the pipeline for changes otherwise. More...
 
 checkUpdatePipelineIntern (int id)
 Check if the given queue exists.
 
PipelineQueue copyPipeline (PipelineQueue old_queue)
 Called by the copy constructor to copy the queues.
 
 resetIntern ()
 Resets the pipeline. More...
 
 stopIntern ()
 Stops all background pipeline queues.
 
 stopInternUnlocked ()
 Stops all background pipeline queues; lock must be held.
 
 submitBulkIntern (AbstractDataProviderBulkRecordInterface i)
 Submits bulk data for processing. More...
 
 submitDataIntern (auto _data)
 Submits a single record for processing. More...
 
 submitIntern (auto _data)
 Submits data for processing. More...
 
 throwPipelineException ()
 Throws an exception if errors occured in background pipeline processing. More...
 

Detailed Description

Defines a class for passing data through record processors.

Record processing pipelines run in background threads. Each queue has an integer queue ID; a queue with ID 0 is created by default as the initial queue.

Note
Pipeline data can be of any type

Member Function Documentation

◆ abort()

DataProvider::DataProviderPipeline::abort ( *bool  ignore_exceptions)

Aborts execution of a pipeline in progress.

Parameters
ignore_exceptionsif True then any processing exceptions are ignored
Exceptions
PIPELINE-FAILEDthrown if ignore_exceptions is not True and there are any errors in pipeline processing, in which case the exception argument will have a list of exception arguments thrown by pipeline threads
Note
The pipeline must be reset once aborted to be used again

◆ append() [1/2]

DataProvider::DataProviderPipeline::append ( AbstractDataProcessor  processor)

Appends a data processor to the default queue.

Note
The initial queue is queue 0
See also
appendQueue()

◆ append() [2/2]

DataProvider::DataProviderPipeline::append ( int  id,
AbstractDataProcessor  processor 
)

Appends a data processor to a queue.

Parameters
idthe queue ID as returned from appendQueue()
processorthe data processor to append to the pipeline queue
Exceptions
PIPELINE-ERRORinvalid queue ID or the queue already terminates in additional queues; the pipeline is locked
Note
The initial queue is queue 0
See also
appendQueue()

◆ appendQueue()

int DataProvider::DataProviderPipeline::appendQueue ( int  id)

Appends a new queue to an existing pipeline and returns the new queue ID.

Parameters
idthe queue to which the new queue will be appended
Returns
the new queue ID
Exceptions
PIPELINE-ERRORthe pipeline is locked, or the given queue does not exist
Note
The initial queue is queue 0
See also
append(int, AbstractDataProcessor)

◆ checkLockedIntern()

DataProvider::DataProviderPipeline::checkLockedIntern ( )
private

Throws an exception if the pipeline is locked.

Must be called with the lock held

◆ checkSubmitIntern()

DataProvider::DataProviderPipeline::checkSubmitIntern ( )
private

Throws an exception if the pipeline cannot be used; locks the pipeline for changes otherwise.

Must be called with the lock held

◆ constructor()

DataProvider::DataProviderPipeline::constructor ( *hash< PipelineOptionInfo opts)

Creates the object with the given options.

Parameters
optsany options for the pipeline; see PipelineOptionInfo for more information
Note
The object is created with an initial queue with ID 0

◆ destructor()

DataProvider::DataProviderPipeline::destructor ( )

Destroys the object.

To ensure that the destructor does not throw a PIPELINE-FAILED exception, call run() or runAsync() and waitDone()

Exceptions
PIPELINE-FAILEDthrown if there are any errors in pipeline processing, in which case the exception argument will have a list of exception arguments thrown by pipeline queue threads

◆ getInfo()

hash<PipelineInfo> DataProvider::DataProviderPipeline::getInfo ( )

Returns pipeline info.

Returns
pipeline info; see PipelineInfo for more information
Note
record count and performance intormation is only valid after the pipeline has completed processing

◆ reset()

DataProvider::DataProviderPipeline::reset ( )

Resets the pipeline.

Exceptions
PIPELINE-ERRORthis method cannot be called while the pipeline is processing data; call abort() or waitDone() before resetting if the pipeline is processing data

◆ resetIntern()

DataProvider::DataProviderPipeline::resetIntern ( )
private

Resets the pipeline.

Must be called with the lock held

◆ submitBulkIntern()

DataProvider::DataProviderPipeline::submitBulkIntern ( AbstractDataProviderBulkRecordInterface  i)
private

Submits bulk data for processing.

Must be called with the lock held

See also
dataprovider_pipeline_bulk_processing

◆ submitDataIntern()

DataProvider::DataProviderPipeline::submitDataIntern ( auto  _data)
private

Submits a single record for processing.

Must be called with the lock held

◆ submitIntern()

DataProvider::DataProviderPipeline::submitIntern ( auto  _data)
private

Submits data for processing.

Must be called with the lock held

◆ throwPipelineException()

DataProvider::DataProviderPipeline::throwPipelineException ( )
private

Throws an exception if errors occured in background pipeline processing.

Must be called with the lock held

◆ waitDone()

DataProvider::DataProviderPipeline::waitDone ( )

Waits for all queues to have processed remaining data.

Exceptions
PIPELINE-FAILEDthrown if there are any errors in pipeline processing, in which case the exception argument will have a list of exception arguments thrown by pipeline queue threads

Member Data Documentation

◆ do_bulk

bool DataProvider::DataProviderPipeline::do_bulk = True
protected

Bulk flag.

See also
dataprovider_pipeline_bulk_processing