#ifndef DATACENTER_H_
#define DATACENTER_H_
#include <map>
#include <list>
#include <string>
#include "LiLo/SoundInfo.h"
#include "MutexCondition.h"
#include "UserInfo.h"
using namespace std;
class DataCenter : MutexCondition{
private:
map<long long, list<SoundInfo *> > m_soundListMap;
void add(long long deviceId, SoundInfo* soundInfo);
public:
DataCenter();
virtual ~DataCenter();
static void addSoundInfo(long long deviceId, SoundInfo *soundInfo);
};
#endif /* DATACENTER_H_ */
DataCenter.cpp file
#include "DataCenter.h"
DataCenter::DataCenter() {
// TODO Auto-generated constructor stub
}
DataCenter::~DataCenter() {
// TODO Auto-generated destructor stub
}
void DataCenter::addSoundInfo(long long deviceId, SoundInfo *soundInfo){
add(deviceId, soundInfo);
}
void DataCenter::add(long long deviceId, SoundInfo *soundInfo){
list<SoundInfo*>& info_list = m_soundListMap[55];
}
I am trying to access the function call addSoundInfo from other classes so I have set this as static. Since the m_soundListMap is not a static so I think I need another function to access to the local data structure.
Inside of the static function, I call add function to add SoundInfo to the list. However, I am getting an error in the static function and it says "Can not call member function .... without object".
How do I fix this problem? Thanks in advance..