Okay, so in my load file function, I'm loading an object manager from file, I need to create a shared pointer to the object manager, which I'm assuming are all the same size, I mean the pointer. The actual managers might be a different size, but I figure as long as I'm just storing a pointer to an object manager it will be the same size..
Then I need to put them in a map, paired with the filename.... Here's the code:
Here's the error I'm getting:Code:class Database { public: typedef boost::shared_ptr<Object_Manager> Raw_Manager; typedef boost::weak_ptr<Object_Manager> Data_Observer; typedef std::map<std::string, Raw_Manager> Manager_Map; // Function to access a specific manager within the map Data_Observer Access_Manager(std::string Filename) { Manager_Map::iterator it = Database_Manager.find(Filename); // check if the manager exists in the map if (it == Database_Manager.end()) { // if not throw an error std::cout << "Manager does not exist!" << std::endl; } else { // if so return a pointer to the manager return Data_Observer(it->second); } } //Save a manager completely to a file template <typename T> void Save_to_File(std::string Filename, Object_Manager Data) { std::ofstream ofs(Filename.c_str()); boost::archive::text_oarchive oa(ofs); // write class instance to archive oa << Data; Data.erase(); // archive and stream closed when destructors are called } // Load a manager from a file and add it to the list of managers void Read_File(std::string Filename, Raw_Manager Data) { // create and open an archive for input std::ifstream ifs(Filename.c_str(), std::ios::binary); boost::archive::text_iarchive ia(ifs); // read class state from archive ia >> Data; // create a pointer to the data Raw_Manager(Data); // pair the filename with the manager typ for easy access Database_Manager.insert(std::make_pair(Filename, Data)); // archive and stream closed when destructors are called } private: Manager_Map Database_Manager; };
Thanks for the helpCode:c:\documents and settings\home\my documents\visual studio 2005\projects\textgame\textgame\database.h(57) : error C2082: redefinition of formal parameter 'Data'![]()



LinkBack URL
About LinkBacks




