Blynk library for embedded hardware. Works with Arduino, ESP8266, Raspberry Pi, Intel Edison/Galileo, LinkIt ONE, Particle Core/Photon, Energia, ARM mbed, etc. http://www.blynk.cc/

Dependents:   Blynk_RBL_BLE_Nano Blynk_MicroBit Blynk_Serial Blynk_RBL_BLE_Nano

Blynk/BlynkTemplates.h

Committer:
vshymanskyy
Date:
2018-01-26
Revision:
22:e1d3971fd902
Parent:
9:7369ec77a3ea

File content as of revision 22:e1d3971fd902:

class BlynkStackOnly
{
protected:
  BlynkStackOnly() {}
  ~BlynkStackOnly() {}

private:
  /// @brief Declared as private to prevent usage of dynamic memory
  void* operator new(size_t size);
  /// @brief Declared as private to prevent usage of dynamic memory
  void operator delete(void *p);
};

class BlynkNonCopyable
{
protected:
  BlynkNonCopyable(){}
  ~BlynkNonCopyable(){}

private:
  /// @brief Declared as private to prevent usage of copy constructor
  BlynkNonCopyable(const BlynkNonCopyable&);
  /// @brief Declared as private to prevent usage of assignment operator
  BlynkNonCopyable& operator=(const BlynkNonCopyable&);
};

template<typename T>
class BlynkSingleton
  : public BlynkNonCopyable
{
public:
  /** @brief Returns the instance of the singleton type
   When called for the first time, the singleton instance will be
   created. All subsequent calls will return a reference to the
   previously created instance.
   @return The singleton instance
   */
  static T* instance()
  {
    static T instance;
    return &instance;
  }
protected:
  BlynkSingleton() {}
  ~BlynkSingleton() {}
};