| 
    PLCnext API Documentation
    20.6.0.30321
    
   | 
 
Message queues allow processes to exchange data in form of messages More...
#include <MessageQueue.hpp>
Public Types | |
| enum | OpenMode { OpenMode::CreateNew = 0, OpenMode::Open, OpenMode::OpenOrCreate } | 
| Supported opening modes for message queues. More... | |
| enum | Access { Access::ReadOnly, Access::WriteOnly, Access::ReadWrite } | 
| Supported access modes for message queues. More... | |
Public Member Functions | |
| MessageQueue (const String &name, bool blocking=false) | |
| Tries to open an already existing message queue. More... | |
| MessageQueue (const String &name, OpenMode openMode, Access permission=Access::ReadWrite, bool blocking=false) | |
| Tries to construct a new message queue based on assigned parameters. More... | |
| MessageQueue (const String &name, OpenMode openMode, Access permission, bool blocking, long maxmsg, long msgsize) | |
| Tries to construct a new message queue based on assigned parameters. More... | |
| ~MessageQueue (void) | |
| Destructs this instance and closes the message queue. More... | |
| bool | IsBlocking () const | 
| Checks if this message queue was created in blocking mode. More... | |
| long | GetMessageCount () const | 
| Queries the current amount of message stored in the message queue. More... | |
| long | GetMaxMessageCount () const | 
| Queries the maximal amount of messages that can be stored inside the message queue. More... | |
| long | GetMaxMessageSize () const | 
| Queries the maximal supported byte-size of a message. More... | |
| void | Send (const char *pMsg, size_t len, unsigned int prio, Milliseconds timeoutMs=Milliseconds(0)) | 
| Sends a message to the queue. More... | |
| size_t | Receive (char *pBuffer, size_t len, unsigned int &prio, Milliseconds timeoutMs=Milliseconds(0)) | 
| Receives a message from the queue. More... | |
| void | Close () | 
| Closes the message queue. More... | |
| void | Unlink () | 
| Deletes the message queue. More... | |
Message queues allow processes to exchange data in form of messages
Message queues are identified by names of the form /somename, that is, each name must begin with a slash otherwise an exception will be thrown during invocation of the constructor.
      
  | 
  strong | 
Supported opening modes for message queues.
| Arp::System::Commons::Ipc::MessageQueue::MessageQueue | ( | const String & | name, | 
| bool | blocking = false  | 
        ||
| ) | 
Tries to open an already existing message queue.
| name | Name of message queue to be opened. Must be of the form /somename. | 
| blocking | Flag indicating if queue should be opened in blocking mode. | 
| Arp::System::Commons::InvalidOperationException | if message queues are not supported. | 
| Arp::Exception | with additional error message if the queue could not be created by the operating system. | 
| Arp::System::Commons::Ipc::MessageQueue::MessageQueue | ( | const String & | name, | 
| OpenMode | openMode, | ||
| Access | permission = Access::ReadWrite,  | 
        ||
| bool | blocking = false  | 
        ||
| ) | 
Tries to construct a new message queue based on assigned parameters.
| name | Name of message queue to be opened. Must be of the form /somename. | 
| openMode | Opening mode for message queue. | 
| permission | Determines access permissions for object owner. | 
| blocking | Flag indicating if queue should be opened in blocking mode. | 
| Arp::System::Commons::InvalidOperationException | if message queues are not supported. | 
| Arp::Exception | with additional error message if the queue could not be created by the operating system. | 
| Arp::System::Commons::Ipc::MessageQueue::MessageQueue | ( | const String & | name, | 
| OpenMode | openMode, | ||
| Access | permission, | ||
| bool | blocking, | ||
| long | maxmsg, | ||
| long | msgsize | ||
| ) | 
Tries to construct a new message queue based on assigned parameters.
| name | Name of message queue to be opened. Must be of the form /somename. | 
| openMode | Opening mode for message queue. | 
| permission | Determines access permissions for object owner. | 
| blocking | Flag indicating if queue should be opened in blocking mode. | 
| maxmsg | Amount of messages that can be stored by the message queue internally. | 
| msgsize | Maximal amount of bytes of a single message. | 
| Arp::System::Commons::InvalidOperationException | if message queues are not supported. | 
| Arp::Exception | with additional error message if the queue could not be created by the operating system. | 
| Arp::System::Commons::Ipc::MessageQueue::~MessageQueue | ( | void | ) | 
Destructs this instance and closes the message queue.
The message queue is not deleted until Unlink is called. That is, a new object instance for the same message queue will reopen the previously created queue.
| void Arp::System::Commons::Ipc::MessageQueue::Close | ( | ) | 
Closes the message queue.
| long Arp::System::Commons::Ipc::MessageQueue::GetMaxMessageCount | ( | ) | const | 
Queries the maximal amount of messages that can be stored inside the message queue.
| Arp::Exception | with additional error information. | 
| long Arp::System::Commons::Ipc::MessageQueue::GetMaxMessageSize | ( | ) | const | 
Queries the maximal supported byte-size of a message.
| Arp::Exception | with additional error information. | 
| long Arp::System::Commons::Ipc::MessageQueue::GetMessageCount | ( | ) | const | 
Queries the current amount of message stored in the message queue.
| Arp::Exception | with additional error information. | 
| bool Arp::System::Commons::Ipc::MessageQueue::IsBlocking | ( | ) | const | 
Checks if this message queue was created in blocking mode.
| size_t Arp::System::Commons::Ipc::MessageQueue::Receive | ( | char * | pBuffer, | 
| size_t | len, | ||
| unsigned int & | prio, | ||
| Milliseconds | timeoutMs = Milliseconds(0)  | 
        ||
| ) | 
Receives a message from the queue.
| pBuffer | Pointer to pre-allocate buffer where message can be stored. | 
| len | Capacaity of buffer in bytes. | 
| prio | Container variable storing the priority of the received message. | 
| timeoutMs | Timeout for call in milliseconds. If set to zero the call blocks until a message can be read from the queue. | 
| Arp::Exception | with additional error information. | 
| void Arp::System::Commons::Ipc::MessageQueue::Send | ( | const char * | pMsg, | 
| size_t | len, | ||
| unsigned int | prio, | ||
| Milliseconds | timeoutMs = Milliseconds(0)  | 
        ||
| ) | 
Sends a message to the queue.
| pMsg | Pointer to message to be send to queue. | 
| len | Byte-length of message. | 
| prio | Priority of message. | 
| timeoutMs | Timeout for send call in milliseconds. If set to zero the call blocks until the message can be send. | 
| Arp::Exception | with additional error information. | 
| void Arp::System::Commons::Ipc::MessageQueue::Unlink | ( | ) | 
Deletes the message queue.
The name of the message queue will be deleted immediately from the file system. The queue itself remains until every reference to the queue is closed.
| Arp::Exception | with additional error information. | 
 1.8.13