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:
Volodymyr Shymanskyy
Date:
2016-06-24
Revision:
3:31e4b850b126
Child:
9:7369ec77a3ea

File content as of revision 3:31e4b850b126:

class BlynkStackOnly
{
protected:
  BlynkStackOnly() {}
  ~BlynkStackOnly() {}
private:
  void* operator new(size_t size);
  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() {}
};