bool IdleUser::Save(ByteBuffer& bb) const { bb.WriteString(_name); bb.WriteUInt32(_id); bb.WriteUInt8((uint8)_type); bb.WriteUInt32(_elapsedTime); return true; }
bool IdleUserContainer::Save(ByteBuffer& bb) const { bb.WriteUInt32(_hashTable.size()); for (const auto iu : _hashTable) { bb.WriteUInt32(iu.first); iu.second->Save(bb); } return true; }
bool GridManager::Save(ByteBuffer& bb) const { bb.WriteUInt32(_lastUserId); bb.WriteUInt32(_lastMachineId); bb.WriteUInt32(Machine::GetLastJobId()); bb.WriteUInt32(_users.size()); for (auto user : _users) user->Save(bb); bb.WriteUInt32(_machines.size()); for (auto machine : _machines) machine->Save(bb); bb.WriteUInt32(_priorityMachines.size()); for (auto pMachine : _priorityMachines) pMachine->Save(bb); bb.WriteUInt32(_waitingJobs.size()); for (std::queue<Job*> temp(_waitingJobs); !temp.empty(); temp.pop()) temp.front()->Save(bb); _idleUsers.Save(bb); return true; }