hydrogen 1.1.1
Object Class Reference

Base class. More...

#include <Object.h>

Inheritance diagram for Object:
AboutDialogContributorList Action AudioEngineInfoForm AudioFileBrowser AutomationPathView Button CpuLoadWidget DetailWaveDisplay Director Download ExportMidiDialog ExportSongDialog Fader FileBrowser FilesystemInfoForm ADSR AudioEngine AudioOutput AutomationPath AutomationPathSerializer CoreActionController Drumkit DrumkitComponent Effects EnvelopePoint EventQueue Files Filesystem H2RGBColor Hydrogen Instrument InstrumentComponent InstrumentLayer InstrumentList LadspaControlPort LadspaFX LadspaFXGroup LadspaFXInfo Legacy LocalFileMng MidiInput MidiOutput Note Pattern PatternList Playlist Preferences SMF SMFBuffer SMFEvent SMFHeader SMFTrack SMFWriter Sample Sampler Song SongEditorPanelBpmWidget SongEditorPanelTagWidget SongReader SongWriter SoundLibraryPropertiesDialog Synth Timeline Translations TransportInfo UIStyle WindowProperties XMLDoc XMLNode HydrogenApp InstrumentEditor InstrumentEditorPanel InstrumentRack Knob LCDCombo LCDDigit LCDDisplay LCDSpinBox LadspaFXProperties LadspaFXSelector LayerPreview MainForm MainSampleWaveDisplay MasterFader MetronomeWidget MidiActionManager MidiActivityWidget MidiMap MidiSenseWidget MidiTable Mixer MixerSettingsDialog NsmClient OscServer PatternEditor PatternEditorInstrumentList PatternEditorPanel PatternEditorRuler PatternFillDialog PixmapWidget PlayerControl PlaylistDialog PreferencesDialog Rotary SampleEditor SampleWaveDisplay SongEditor SongEditorPanel SongEditorPatternList SongEditorPositionRuler SoundLibraryDatabase SoundLibraryExportDialog SoundLibraryImportDialog SoundLibraryInfo SoundLibraryOpenDialog SoundLibraryPanel SoundLibraryRepositoryDialog SoundLibrarySaveDialog SoundLibraryTree SplashScreen TargetWaveDisplay VirtualPatternDialog WaveDisplay

Data Structures

struct  obj_cpt_t
 an objects class map item type More...
 

Public Member Functions

 ~Object ()
 destructor More...
 
 Object (const Object &obj)
 copy constructor More...
 
 Object (const char *class_name)
 constructor More...
 
const char * class_name () const
 return the class name More...
 
virtual QString toQString (const QString &sPrefix, bool bShort=true) const
 Formatted string version for debugging purposes. More...
 
void Print (bool bShort=true) const
 Prints content of toQString() via DEBUGLOG. More...
 

Static Public Member Functions

static void set_count (bool flag)
 enable/disable class instances counting More...
 
static bool count_active ()
 return true if class instances counting is enabled More...
 
static unsigned objects_count ()
 return the number of objects More...
 
static void write_objects_map_to (std::ostream &out)
 output the full objects map to a given ostream More...
 
static void write_objects_map_to_cerr ()
 output objects map to stderr More...
 
static int bootstrap (Logger *logger, bool count=false)
 must be called before any Object instantiation ! More...
 
static Loggerlogger ()
 return the logger instance More...
 

Static Public Attributes

static QString sPrintIndention = " "
 String used to format the debugging string output of some core classes. More...
 

Static Protected Attributes

static Logger__logger = nullptr
 logger instance pointer More...
 

Private Types

typedef std::map< const char *, obj_cpt_tobject_map_t
 the objects class map type More...
 

Static Private Member Functions

static void del_object (const Object *obj)
 search for the class name within __objects_map, decrease class and global counts More...
 
static void add_object (const Object *obj, bool copy)
 search for the class name within __objects_map, create it if doesn't exists, increase class and global counts More...
 

Private Attributes

const char * __class_name
 the object class name More...
 

Static Private Attributes

static bool __count = false
 should we count class instances More...
 
static unsigned __objects_count = 0
 total objects count More...
 
static object_map_t __objects_map
 objects classes and instances count structure More...
 
static pthread_mutex_t __mutex
 yeah this has to be thread safe More...
 

Detailed Description

Base class.

Member Typedef Documentation

◆ object_map_t

typedef std::map<const char*, obj_cpt_t> object_map_t
private

the objects class map type

Constructor & Destructor Documentation

◆ ~Object()

~Object ( )

destructor

◆ Object() [1/2]

Object ( const Object obj)

copy constructor

◆ Object() [2/2]

Object ( const char *  class_name)

constructor

Member Function Documentation

◆ add_object()

void add_object ( const Object obj,
bool  copy 
)
inlinestaticprivate

search for the class name within __objects_map, create it if doesn't exists, increase class and global counts

Parameters
objthe object to be taken into account
copyis it called from a copy constructor

◆ bootstrap()

int bootstrap ( Logger logger,
bool  count = false 
)
static

must be called before any Object instantiation !

Parameters
loggerthe logger instance used to send messages to
countshould we count objects instances or not

◆ class_name()

const char * class_name ( ) const
inline

return the class name

◆ count_active()

static bool count_active ( )
inlinestatic

return true if class instances counting is enabled

◆ del_object()

void del_object ( const Object obj)
inlinestaticprivate

search for the class name within __objects_map, decrease class and global counts

Parameters
objthe object to be taken into account

◆ logger()

static Logger * logger ( )
inlinestatic

return the logger instance

◆ objects_count()

static unsigned objects_count ( )
inlinestatic

return the number of objects

◆ Print()

void Print ( bool  bShort = true) const

Prints content of toQString() via DEBUGLOG.

Parameters
bShortWhether to display the content of the member class variables and to use line breaks.

◆ set_count()

void set_count ( bool  flag)
static

enable/disable class instances counting

Parameters
flagthe counting status to set

◆ toQString()

QString toQString ( const QString &  sPrefix,
bool  bShort = true 
) const
virtual

Formatted string version for debugging purposes.

Parameters
sPrefixString prefix which will be added in front of every new line
bShortInstead of the whole content of all classes stored as members just a single unique identifier will be displayed without line breaks.
Returns
String presentation of current object.

Reimplemented in ADSR, AutomationPath, Drumkit, DrumkitComponent, Instrument, InstrumentComponent, InstrumentLayer, InstrumentList, Note, Pattern, PatternList, Sample, and Song.

◆ write_objects_map_to()

void write_objects_map_to ( std::ostream &  out)
static

output the full objects map to a given ostream

Parameters
outthe ostream to write to

◆ write_objects_map_to_cerr()

static void write_objects_map_to_cerr ( )
inlinestatic

output objects map to stderr

Field Documentation

◆ __class_name

const char* __class_name
private

the object class name

◆ __count

bool __count = false
staticprivate

should we count class instances

◆ __logger

Logger * __logger = nullptr
staticprotected

logger instance pointer

◆ __mutex

pthread_mutex_t __mutex
staticprivate

yeah this has to be thread safe

◆ __objects_count

unsigned __objects_count = 0
staticprivate

total objects count

◆ __objects_map

Object::object_map_t __objects_map
staticprivate

objects classes and instances count structure

◆ sPrintIndention

QString sPrintIndention = " "
static

String used to format the debugging string output of some core classes.