Arduino-Redis
A Redis library for Arduino.
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
RedisObject Class Referenceabstract

Detailed Description

A basic object model for the Redis serialization protocol (RESP): https://redis.io/topics/protocol

Definition at line 25 of file RedisInternal.h.

Public Types

enum  Type {
  NoType = '\0', SimpleString = '+', Error = '-', Integer = ':',
  BulkString = '$', Array = '*', InternalError = '!'
}
 

Public Member Functions

 RedisObject (Type tc)
 
 RedisObject (Type tc, Client &c)
 
virtual void init (Client &client)
 
virtual String RESP ()=0
 
virtual operator String ()
 
Type type () const
 

Static Public Member Functions

static std::shared_ptr< RedisObjectparseType (Client &)
 

Protected Attributes

String data
 
Type _type = Type::NoType
 

#include <RedisInternal.h>

Inheritance diagram for RedisObject:
Inheritance graph
[legend]

Member Enumeration Documentation

◆ Type

Denote a basic Redis type, with NoType and InternalError defined specifically for this API

Definition at line 28 of file RedisInternal.h.

Member Function Documentation

◆ init()

void RedisObject::init ( Client &  client)
virtual

Initialize a RedisObject instance from the bytestream represented by 'client'. Only does very basic (e.g. SimpleString-style) parsing of the object from the byte stream. Concrete subclasses are expected to override this to provide class-specific parsing & initialization logic.

Reimplemented in RedisArray, and RedisBulkString.

Definition at line 31 of file RedisInternal.cpp.

◆ operator String()

virtual RedisObject::operator String ( )
inlinevirtual

Produce a human-readable String representation. Base implementation only returns the type character, so should be overriden.

Definition at line 58 of file RedisInternal.h.

◆ RESP()

virtual String RedisObject::RESP ( )
pure virtual

Produce the Redis serialization protocol (RESP) representation. Must be overridden.

Implemented in RedisInternalError, RedisArray, RedisBulkString, and RedisSimpleString.