TextFileWriter Class
(Sequencer::TextFileWriter)Header: | #include <TextFileWriter> |
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
TextFileWriter Usage
The TextFileWriter ServiceBlock can be used to write contents to any file. Specify the FileName and whether to Append or not. Trigger writes by sending Write events to the block. This will cause the TextLine to be written to the file. If an error occurs, the Error event is emitted (with ErrorText describing the error) and writing is aborted. When writing is successfully done, a Done event is emitted.
Events and Arguments
The TextFileWriter 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 |
Write | Input | Writes the TextLine to the file. If Append is set, the TextLine is written at the end of the file, else the file is truncated and then the TextLine is written. |
Done | Output | Emitted by the TextFileWriter when file writing 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 TextFileWriter:
Argument Name | Type | Content | Description |
---|---|---|---|
FileName | Input | Relative or full native path name | The file name to write to, with the optional path prefix, relative to the application folder |
TextLine | Input | any | The text or data that should be written to the file |
Append | Input | 0/1 | Set to 0 if you want to overwrite the content of the file, or set to 1 if you want to grow the file by appending to it for each Write event. |
ErrorText | Output | Error text | An error-text as reported by the underlying operating system. |
See also MessageArgument, ReceiveMessage, SendMessage, DebugPrinter, Basic Block, Service Blocks, and Sequencer::TextFileReader.
Member Function Documentation
[override virtual]
Sequencer::EventID TextFileWriter::ProcessAsync(const EventID &eventInID, ArgumentData &data) const
Reimplemented from ServiceBlock::ProcessAsync().
Run asynchronous writing of 'FileName' on each 'Write' event by taking TextLine and writing it to the file. Append dictates whether to append to the file or to overwrite the existing content. Init triggers Inited.
bool TextFileWriter::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.