📄 linkedstatus.h
字号:
/** * Copyright (c) 2006 Michele Mastrogiovanni. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *///// Questa classe rappresenta lo stato di un nodo:// è una lista di stati che si susseguono temporalmente in cui// vengono mantenute 2 tipi di informazioni:// 1) I dati relativi a un nodo.// 2) I dati relativi allo stato.//// E'possibile solo memorizzare informazioni successive// oppure richiedere informazioni passate.// La storia del nodo è ridotta ad un certo numero di istanti// prefissati.//#include <list>using namespace std;template<typename _DataNode, typename _DataTime>struct LinkedData { _DataNode dataNode; _DataTime dataTime;};template<typename _DataNode, typename _DataTime>class LinkedStatus{ public: LinkedStatus(int history) : history(abs(history)) {} LinkedStatus() : history(-1) {} void addState(_DataNode data, const _DataTime & time); _DataNode & getState(const _DataTime time); bool isPresent(const _DataTime time); _DataTime & getLast(); protected: typedef struct LinkedData<_DataNode, _DataTime> _myStruct; typedef list<_myStruct> _myList; _myList l; int history; _DataNode empty;};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -