to avoid dynamic casting, introuced CookieIF
This commit is contained in:
@ -1,31 +1,35 @@
|
||||
#ifndef COOKIE_H_
|
||||
#define COOKIE_H_
|
||||
#include <framework/devicehandlers/DeviceHandlerIF.h>
|
||||
#include <framework/devicehandlers/CookieIF.h>
|
||||
|
||||
/**
|
||||
* @brief This datatype is used to identify different connection over a single interface
|
||||
* (like RMAP or I2C)
|
||||
* @details
|
||||
* To use this class, implement a communication specific child cookie. This cookie
|
||||
* can be used in the device communication interface by performing
|
||||
* a C++ dynamic cast and passing it to a child device handler, which stores
|
||||
* it and passes the Cookie to the communication interface where it can be used
|
||||
* by again performing a dynamic cast.
|
||||
* To use this class, implement a communication specific child cookie which
|
||||
* inherits Cookie. Cookie instances are created in config/ Factory.cpp by calling
|
||||
* CookieIF* childCookie = new ChildCookie(...).´
|
||||
*
|
||||
* This cookie is then passed to the child device handlers, which stores the
|
||||
* pointer and passes it to the communication interface functions.
|
||||
*
|
||||
* The cookie can be used to store all kinds of information
|
||||
* about the communication, like slave addresses, communication status,
|
||||
* communication parameters etc.
|
||||
*
|
||||
* @ingroup comm
|
||||
*/
|
||||
class Cookie{
|
||||
class Cookie: public CookieIF {
|
||||
public:
|
||||
Cookie() = default;
|
||||
Cookie();
|
||||
Cookie(address_t logicalAddress_);
|
||||
virtual ~Cookie(){}
|
||||
virtual ~Cookie() {};
|
||||
|
||||
void setMaxReplyLen(size_t maxReplyLen_);
|
||||
virtual void setAddress(address_t logicalAddres_);
|
||||
virtual void setMaxReplyLen(size_t maxReplyLen_);
|
||||
|
||||
address_t getAddress() const;
|
||||
size_t getMaxReplyLen() const;
|
||||
virtual address_t getAddress() const;
|
||||
virtual size_t getMaxReplyLen() const;
|
||||
private:
|
||||
address_t logicalAddress = 0;
|
||||
size_t maxReplyLen = 0;
|
||||
|
Reference in New Issue
Block a user