[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[oMetah-devel] ometah/common itsSet.hpp
From: |
Jean-Philippe Aumasson |
Subject: |
[oMetah-devel] ometah/common itsSet.hpp |
Date: |
Tue, 07 Jun 2005 11:33:29 -0400 |
CVSROOT: /cvsroot/ometah
Module name: ometah
Branch:
Changes by: Jean-Philippe Aumasson <address@hidden> 05/06/07 15:33:29
Modified files:
common : itsSet.hpp
Log message:
* added vector of keys (keyList)
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/common/itsSet.hpp.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
Patches:
Index: ometah/common/itsSet.hpp
diff -u ometah/common/itsSet.hpp:1.12 ometah/common/itsSet.hpp:1.13
--- ometah/common/itsSet.hpp:1.12 Tue Jun 7 12:31:44 2005
+++ ometah/common/itsSet.hpp Tue Jun 7 15:33:29 2005
@@ -1,8 +1,8 @@
/***************************************************************************
- * $Id: itsSet.hpp,v 1.12 2005/06/07 12:31:44 nojhan Exp $
+ * $Id: itsSet.hpp,v 1.13 2005/06/07 15:33:29 jpa Exp $
* Copyright : Université Paris 12 Val-de-Marne
* (61 avenue du Général de Gaulle, 94010, Créteil, France)
- * Author: Walid TFAILI <address@hidden>
+ * Author: Walid TFAILI <address@hidden>, Jean-Philippe Aumasson
<address@hidden>
****************************************************************************/
/*
@@ -26,6 +26,7 @@
#include <string>
#include <hash_map.h>
+#include <ostream>
#include "logic.hpp"
@@ -51,6 +52,9 @@
//! The current choice
string currentItem;
+ //! List of keys
+ vector<string> keyList;
+
public:
//! Add an object
/*!
@@ -59,36 +63,41 @@
It use the "name" method to get the key associated to the object.
*/
void add(T anItem)
-{
+ {
// key is based on a const char*, so we take the c_str
collection[anItem->getKey().c_str()] = anItem;
-};
+ keyList.push_back(anItem->getKey());
+ };
//! Remove an object
/*!
Remove a T member from the collection hash map, specifying its key
*/
void remove(string name)
-{
+ {
// find the element iterator
// erase the element
collection.erase(
- collection.find(name.c_str())
- );
-};
+ collection.find(name.c_str())
+ );
+ };
//! Change the current choice
void choose(string name)
-{
+ {
this->currentItem = name;
-};
+ };
//! Return a pointer on the current object
T item()
-{
+ {
return collection[currentItem.c_str()];
-};
+ };
+ vector<string> getKeyList()
+ {
+ return keyList;
+ }
};
#endif
- [oMetah-devel] ometah/common itsSet.hpp,
Jean-Philippe Aumasson <=