blynk & neopixelring & w7500

Fork of WIZwiki-7500_Blynk by IOP

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers BlynkTemplates.h Source File

BlynkTemplates.h

00001 class BlynkStackOnly
00002 {
00003 protected:
00004   BlynkStackOnly() {}
00005   ~BlynkStackOnly() {}
00006 
00007 private:
00008   /// @brief Declared as private to prevent usage of dynamic memory
00009   void* operator new(size_t size);
00010   /// @brief Declared as private to prevent usage of dynamic memory
00011   void operator delete(void *p);
00012 };
00013 
00014 class BlynkNonCopyable
00015 {
00016 protected:
00017   BlynkNonCopyable(){}
00018   ~BlynkNonCopyable(){}
00019 
00020 private:
00021   /// @brief Declared as private to prevent usage of copy constructor
00022   BlynkNonCopyable(const BlynkNonCopyable&);
00023   /// @brief Declared as private to prevent usage of assignment operator
00024   BlynkNonCopyable& operator=(const BlynkNonCopyable&);
00025 };
00026 
00027 template<typename T>
00028 class BlynkSingleton
00029   : public BlynkNonCopyable
00030 {
00031 public:
00032   /** @brief Returns the instance of the singleton type
00033    When called for the first time, the singleton instance will be
00034    created. All subsequent calls will return a reference to the
00035    previously created instance.
00036    @return The singleton instance
00037    */
00038   static T* instance()
00039   {
00040     static T instance;
00041     return &instance;
00042   }
00043 protected:
00044   BlynkSingleton() {}
00045   ~BlynkSingleton() {}
00046 };
00047