TextFileReader Class
(Sequencer::TextFileReader)Header: | #include <TextFileReader> |
Inherits: | Sequencer::ServiceBlock |
Public Functions
bool | ProcessEvent(const Sequencer::EventID &eventInID, Sequencer::ArgumentData &data) override |
Reimplemented Public Functions
virtual Sequencer::EventID | ProcessAsync(const EventID &eventInID, ArgumentData &data) const override |
- 2 public functions inherited from Sequencer::ServiceBlock
- 18 public functions inherited from CDPOperator
- 17 public functions inherited from CDPOperatorBase
- 46 public functions inherited from CDPBaseObject
- 26 public functions inherited from CDP::StudioAPI::CDPNode
- 22 public functions inherited from CDP::StudioAPI::ICDPNode
Additional Inherited Members
- 1 public variable inherited from CDPOperatorBase
- 1 static public member inherited from CDPBaseObject
- 11 protected functions inherited from Sequencer::ServiceBlock
- 1 protected function inherited from CDP::StudioAPI::CDPNode
- 8 protected variables inherited from CDPOperator
- 5 protected variables inherited from CDPOperatorBase
- 11 protected variables inherited from CDPBaseObject
Detailed Description
TextFileReader Usage
The TextFileReader ServiceBlock can be used to read contents line-by-line from a file. Specify the FileName and trigger the file read by sending a Read event to the block. This will cause the Line contents to be emitted for each line in the file, along with the Index. If an error occurs, the Error event is emitted (with ErrorText describing the error) and further processing is aborted. When the reading is done successfully, a Done event is emitted.
Events and Arguments
The TextFileReader ServiceBlock has the following events:
Name | Type | Description |
---|---|---|
Init | Input | Can be used to chain Init events / prepare the system |
Inited | Output | Can be used to chain Init events / prepare the system |
Read | Input | Reads line by line of data from the file in FileName, until end-of-file is reached. Each line is emitted in Line along with the Index. |
Line | Output | Emitted by the TextFileReader when a line has been read. The content of the line is available in TextLine |
Done | Output | Emitted by the TextFileReader when file reading is complete. |
Error | Output | If an error occurs, this Error event is emitted, and the error text can be found in ErrorText. |
The following Arguments can be used to configure the TextFileReader:
Argument Name | Type | Value | Description |
---|---|---|---|
FileName | Input | Relative or full native path name | The file name to read from, with the optional path prefix, relative to the application folder |
TextLine | Output | any | The text or data that that was read from the file |
ErrorText | Output | Error text | An error-text as reported by the underlying operating system. |
Index | Output | Current line index (0-based) | The 0-based index of the current line emitted by Line |
See also MessageArgument, ReceiveMessage, SendMessage, DebugPrinter, Basic Block, Service Blocks, and Sequencer::TextFileWriter.
Member Function Documentation
[override virtual]
Sequencer::EventID TextFileReader::ProcessAsync(const EventID &eventInID, ArgumentData &data) const
bool TextFileReader::ProcessEvent(const Sequencer::EventID &eventInID, Sequencer::ArgumentData &data)
Sets up arguments for processing by ProcessAsync
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.