KSquare Utilities
MLClass.h
Go to the documentation of this file.
1 #if !defined(_MLCLASS_)
2 #define _MLCLASS_
3 
4 /**
5  *@class KKMLL::MLClass
6  *@brief Represents a "Class" in the Machine Learning Sense.
7  *@author Kurt Kramer
8  *@details
9  * Each instance of this class represents a single Class as used in
10  * Machine Learning sense. Each instance of 'FeatureVector' class
11  * will point to an instance of this class. There can only be one
12  * instance of each Class in memory. Specifically the 'name' field
13  * will be unique. This is enforced by making the constructor and
14  * destructor private. The only way to create a new instance of a
15  * 'MLClass' object is to call one of the static methods of
16  * 'CreateNewMLClass'. These methods will look for a instance of
17  * 'MLClass' that already exists. If one does not they will then
18  * create a new one.
19  *
20  * Please refer to MLClassList at bottom of file. That class is
21  * the object you will most be using when dealing with Images.
22  * classes.
23  *
24  * UmiClass and PicesClass
25  * There is a special relationship between this class and a class
26  * called 'UmiClass' and 'PicesClass in the 'UnManagedInterface'
27  * and PicesInterface libraries, ".net' Managed libraries'. These
28  * managed c++ versions of this class. There is a one-to-one
29  * correspondence between the two classes. When ever a instance
30  * of 'UmiClass' or 'PicesClass' get created they will automatic-
31  * ally call the static method 'MLClass::CreateNewMLClass' to get
32  * the unmanaged version of the class.
33  *@see KKMLL::MLClassList, KKMLL::FeatureVector, UnManagedInterface::UmiClass, MLL::PicesClass
34  */
35 
36 
37 #include "GoalKeeper.h"
38 #include "KKStr.h"
39 #include "KKQueue.h"
40 #include "RunLog.h"
41 #include "XmlStream.h"
42 
43 
44 namespace KKMLL
45 {
46  class MLClass;
47  typedef MLClass* MLClassPtr;
48 
49  class MLClassList;
50  typedef MLClassList* MLClassListPtr;
51 
52  class MLClass
53  {
54  private:
55  static MLClassListPtr existingMLClasses;
56  static std::map<MLClassListPtr,MLClassListPtr> existingClassLists;
57 
58  static void AddImageClassList (MLClassListPtr list);
59  static void DeleteImageClassList (MLClassListPtr list);
60 
61 
62  public:
64 
65  /**
66  *@brief Static method used to create a new instance of a MLClass object.
67  *@details
68  * Used to get pointer to existing MLClass object that already exists
69  * in 'existingMLClasses'. If one does not exist then a new MLClass
70  * object with this name will be created.
71  *
72  * This is the only method that can actually create a MLClass instance.
73  * The idea is that there is only one MLClass object ever created for
74  * each class. All MLClassList container objects will point to
75  *@param[in] _name Name of class to be created.
76  *@return Pointer to an instance of 'MLClass' that will have the name '_name'.
77  */
78  static MLClassPtr CreateNewMLClass (const KKStr& _name,
79  kkint32 _classId = -1
80  );
81 
83 
84  static MLClassPtr GetByClassId (kkint32 _classId);
85 
86  /**
87  *@brief Changes the name of an existing class verifying that a duplicate does not get created.
88  *@details Since the class name can not be duplicated and there is a nameIndex structure maintained by each
89  * 'MLClassList' instances we need to make sure the name is not already in use by another instance of
90  * 'mlClass'. This is done by first trying to update the 'nameIndex' in 'existingMLClasses' (list
91  * of all 'inageClass' instances in existence); if this is successful will then change the name in 'mlClass'
92  * and update all existing 'MLClassList' instances 'nameIndex' structures.
93  *
94  *@param[in,out] mlClass Class having its name changed; upon entry should contain its original name; if
95  * no other class already has its name it will be updated to the value in 'newName'.
96  *@param[in] newName The new name that 'mlClass' is to receive.
97  *@param[out] changeSuccessful Returns 'true' if name was changed; if set to false then the 'name' field in 'mlClass'
98  * will not be changed.
99  */
100  static void ChangeNameOfClass (MLClassPtr mlClass,
101  const KKStr& newName,
102  bool& changeSuccessful
103  );
104 
105  static void ResetAllParentsToAllClasses ();
106 
107 
108  /** @brief Call this as the last thing the application does, will delete all existing instances of 'MLClass'. */
109  static void FinalCleanUp ();
110 
111 
112  private:
113  static void CreateBlocker ();
114 
115  static GoalKeeperPtr blocker;
116  static bool needToRunFinalCleanUp;
117 
118  friend class KKQueue<MLClass>;
119  friend class MLClassList;
120 
121  MLClass (const KKStr& _name);
122 
123  MLClass (const MLClass& mlClass);
124 
125  ~MLClass ();
126 
127  void Name (const KKStr& _name);
128 
129 
130  public:
131  static KKStr GetClassNameFromDirName (const KKStr& subDir);
132 
134 
135 
136  kkint32 ClassId () const {return classId;} /**< From MySQL table Classes, '-1' indicates that not loaded from mysql table. */
137  void ClassId (kkint32 _classId) {classId = _classId;}
138 
139  float CountFactor () const {return countFactor;}
140  void CountFactor (float _countFactor) {countFactor = _countFactor;}
141 
142  const KKStr& Description () const {return description;}
143  void Description (const KKStr& _description) {description = _description;}
144 
145  bool IsAnAncestor (MLClassPtr c) const; /**< Returns true if 'c' is an ancestor */
146 
148 
149  bool Mandatory () const {return mandatory;}
150  void Mandatory (bool _mandatory) {mandatory = _mandatory;}
151 
153 
154  const KKStr& Name () const {return name;}
155  const KKStr& UpperName () const {return upperName;} /**< Returns name capitalized. */
156 
157  MLClassPtr Parent () const {return parent;}
158  void Parent (MLClassPtr _parent) {parent = _parent;}
159  const KKStr& ParentName () const;
160 
161 // void ProcessRawData (KKStr& data); /**< Parses 'data' and populates this instance.
162 // * @details Extracts name of class from first field in 'data' using whitespace
163 // * ',', ' ', '\n', '\r', or '\t' as delimiter. Data will have this name removed from
164 // * the beginning of it.
165 // */
166 
167  bool StoredOnDataBase () const {return storedOnDataBase;}
168 
169  void StoredOnDataBase (bool _storedOnDataBase) {storedOnDataBase = _storedOnDataBase;}
170 
171  bool Summarize () const {return summarize;} /**< Indicates that Classification report should produce a summary
172  * column for the family of classes decedent from this class.
173  * Example classes that would set this field true are 'Protist',
174  * 'Phyto', 'Crustacean', etc....
175  */
176 
177  void Summarize (bool _summarize) {summarize = _summarize;}
178 
179  KKStr ToString () const; /**< Returns a KKStr representing this instance.
180  * @details This string will later be written to a file.
181  */
182 
183  bool UnDefined () const {return unDefined;}
184  void UnDefined (bool _unDefined) {unDefined = _unDefined;}
185 
186  void WriteXML (const KKStr& varName,
187  std::ostream& o
188  ) const;
189  private:
190  kkint32 classId; /**< From MySQL table Classes, '-1' indicates that not loaded from table. */
191  float countFactor; /**< Specifies number to increment count when this class picked; ex: Shrinmp_02 would have 2.0. */
192  KKStr description;
193 
194  bool mandatory; /**< Class needs to be included in Classification Status even if none occurred. */
195 
196  KKStr name; /**< Name of Class. */
197 
198 
199  MLClassPtr parent; /**< Supports the concept of Parent/Child classes as part of a hierarchy.
200  * Adding this field to help support the PicesInterface version of this class.
201  */
202 
203  bool storedOnDataBase; /**< Because we have no control over classes that users unilaterally create
204  * it would be useful to know which ones are stored in the PICES database
205  * table "Classes".
206  */
207 
208  bool summarize; /**< Indicates that Classification report should produce a summary column
209  * for the family of classes decedent from this class. Example classes that
210  * would set this field true are 'Protist', 'Phyto', 'Crustacean', etc....
211  */
212 
213  KKStr upperName; /**< Upper case version of name; Used by LookUpByName to assist in performance. */
214 
215  bool unDefined; /**< A class who's name is "", "UnKnown", "UnDefined", or starts with "Noise_" */
216 
217  }; /* MLClass */
218 
219  #define _MLClass_Defined_
220 
221 
222  typedef MLClass* MLClassPtr;
223 
224 
225 
226 
227  /**
228  *@class MLClassList
229  *@brief Maintains a list of MLClass instances.
230  *@details There will be only one instance of each MLClass by name and these instances will
231  * be owned by MLClass::existingMLClasses.
232  */
233  class MLClassList: public KKQueue<MLClass>
234  {
235  public:
236  MLClassList ();
237 
238 
239  /** @brief Copy constructor; will copy list but not own the contents. */
240  MLClassList (const MLClassList& _mlClasses);
241 
242 
243 
244  /** @brief Construct a MLClassList object from the contents of a file. */
245  MLClassList (const KKStr& fileName,
246  bool& successfull
247  );
248 
249 
250  virtual
251  ~MLClassList ();
252 
253 
254  virtual
255  void AddMLClass (MLClassPtr _mlClass);
256 
257 
258  static
260  char delimiter
261  );
262 
263 
264  /** @brief Clears the contents of this list and updates nameIndex structure. */
265  virtual
266  void Clear ();
267 
268 
270 
272 
273  /**
274  *@brief Using the class names create two title lines where we split
275  * names by "_" characters between the two lines.
276  */
277  void ExtractTwoTitleLines (KKStr& titleLine1,
278  KKStr& titleLine2
279  ) const;
280 
281 
282  /**
283  *@brief Using the class names create three title lines where we split names
284  * by "_" characters between the three lines.
285  */
286  void ExtractThreeTitleLines (KKStr& titleLine1,
287  KKStr& titleLine2,
288  KKStr& titleLine3
289  ) const;
290 
291  void ExtractThreeTitleLines (KKStr& titleLine1,
292  KKStr& titleLine2,
293  KKStr& titleLine3,
294  kkint32 fieldWidth
295  ) const;
296 
297  /**
298  *@brief Will generate a HTML formatted string that can be used in a HTML table.
299  *@details Using the class name's create one header line for a HTML table. The
300  * underscore character ("_") will be used to separate levels
301  */
302  KKStr ExtractHTMLTableHeader () const;
303 
304 
306 
307 
308  /** @brief return pointer to instance with '_name'; if none exists, create one and add to list. */
309  virtual
310  MLClassPtr GetMLClassPtr (const KKStr& _name);
311 
312  MLClassPtr GetNoiseClass () const;
313 
314  /**
315  *@brief Return a pointer to the MLClass object that represents the unknown Class in the list.
316  *@details That is the one with the name 'UNKNOWN'. If none is found then one will be created
317  * and added to the list.
318  */
320 
321 
322  /**
323  *@brief Returns a pointer of MLClass object with name (_name); if none
324  * in list will then return NULL.
325  *@param[in] _name Name of MLClass to search for.
326  *@return Pointer to MLClass or NULL if not Found.
327  */
328  virtual
329  MLClassPtr LookUpByName (const KKStr& _name) const;
330 
331 
332  virtual
333  MLClassPtr LookUpByClassId (kkint32 _classId) const;
334 
335 
336  void Load (const KKStr& _fileName,
337  bool& _successfull
338  );
339 
341 
342  static
344  const MLClassList& list2
345  );
346 
347 
349 
350 
351  virtual
353 
354  virtual
356 
357  virtual
358  void PushOnBack (MLClassPtr mlClass);
359 
360  virtual
361  void PushOnFront (MLClassPtr mlClass);
362 
363 
364  void Save (KKStr _fileName,
365  bool& _successfull
366  );
367 
368  void SortByName ();
369 
370  KKStr ToString () const;
371 
372  KKStr ToCommaDelimitedStr () const;
373 
374  KKStr ToTabDelimitedStr () const;
375 
377 
378  void WriteXML (const KKStr& varName,
379  std::ostream& o
380  ) const;
381 
382  bool operator== (const MLClassList& right) const;
383 
384  bool operator!= (const MLClassList& right) const;
385 
386 
387  MLClassList& operator= (const MLClassList& right);
388 
389  MLClassList& operator-= (const MLClassList& right); /**< remove all classes that in the 'right' parameter */
390 
391  MLClassList operator- (const MLClassList& right) const; /**< remove all classes that in the 'right' parameter */
392 
393  MLClassList& operator+= (const MLClassList& right); /**< add all classes that are in the 'right' parameter */
394 
395 
396  private:
397  friend class MLClass;
398 
399  void AddMLClassToNameIndex (MLClassPtr _mlClass);
400 
401 
402  /** @brief Should only be called from "MLClass::ChangeNameOfClass". */
403  void ChangeNameOfClass (MLClassPtr mlClass,
404  const KKStr& oldName,
405  const KKStr& newName,
406  bool& successful
407  );
408 
409  typedef std::map<KKStr,MLClassPtr> NameIndex;
410  NameIndex nameIndex;
411 
412  /**
413  *@brief Set the owner flag.
414  *@details Forcing Owner to be private to make sure that no list can own any MLClass objects, to
415  * prevent accidental deletion of a 'MLClass' object. Only 'MLClass::existingMLClasses' may own
416  * the contents of its list.
417  */
418  void Owner (bool _owner) {KKQueue<MLClass>::Owner (_owner);}
419 
420  bool undefinedLoaded; /**< Indicates if the class that represents examples that have not been
421  * classified yet has been loaded.
422  */
423 
424  class MLClassNameComparison;
425  }; /* MLClassList */
426 
427  #define _MLClassList_Defined_
428 
429 
430 
431  std::ostream& operator<< ( std::ostream& os,
432  const MLClassList& classList
433  );
434 
435 
436  KKStr& operator<< ( KKStr& str,
437  const MLClassList& classList
438  );
439 
440 
441  typedef MLClassList* MLClassListPtr;
442 
443 
444 
445 
446 
447 
448  /**
449  *@class MLClassIndexList
450  *@brief Maintains a list of classes and their associated integer index.
451  *@details
452  * Multiple Classes can have the same index but a class may only appear once in the list. The primary purpose
453  * of this class is to allow the quick access to classes by numerical indexes. This comes in useful when
454  * communicating with another library that does not recognize alpha numeric strings for class names such
455  * libSVM which only uses integers class names.
456  *@see KKMLL::Model
457  *@see KKMLL::FeatureEncoder2::compress
458  */
460  {
461  public:
463 
464  MLClassIndexList ();
465  MLClassIndexList (const MLClassIndexList& _list);
466  MLClassIndexList (const MLClassList& _classes);
467 
468  virtual ~MLClassIndexList () {}
469 
471 
472  virtual
473  void Clear ();
474 
475  void AddClass (MLClassPtr _ic,
476  bool& _dupEntry
477  );
478 
479 
481  kkint16 _classIndex,
482  bool& _dupEntry
483  );
484 
485  /**
486  @brief Returns the corresponding index to the class 'c'; if not in list will return -1.
487  */
489 
490 
491  /**
492  *@brief Locates the MLClass that was assigned classIndex.
493  *@details If not found then returns NULL. If more than one class has the same classIndex will return the first one added.
494  */
495  MLClassPtr GetMLClass (kkint16 classIndex);
496 
497 
498  void ParseClassIndexList (const KKStr& s,
499  RunLog& log
500  );
501 
502 
503  /**
504  *@brief Returns string consisting of all contained classes indicating ClassIndex assigned to each class.
505  *@details Each class will be separated by a comma(",") delimiter character and each class will consist of
506  * "ClassName" and associated "ClassIndex" separated by colon(":") character. The class names will be
507  * enclosed in quotes("). The method "ParseClassIndexList" will be able to decode this string to
508  * repopulate an instance of "MLClassIndexList".
509  *@see "KKStr::QuotedStr"
510  * Example String: "Copepod":1,"Doliolid":2,"Larvacean":3
511  */
512  KKStr ToCommaDelString () const;
513 
514 
515  virtual
516  void ReadXML (XmlStream& s,
517  XmlTagConstPtr tag,
518  VolConstBool& cancelFlag,
519  RunLog& log
520  );
521 
522 
523  virtual
524  void WriteXML (const KKStr& varName,
525  std::ostream& o
526  ) const;
527 
528 
529  private:
530  std::map<kkint16, MLClassPtr> shortIdx;
531  kkint16 largestIndex; /**< largest index used so far. */
532  }; /* MLClassIndexList */
533 
534  typedef MLClassIndexList::MLClassIndexListPtr MLClassIndexListPtr;
535 
536  #define _MLClassIndexList_Defined_
537 
538 
540 
541 
542 
543 
544  /**
545  *@details
546  * - Because a MLClass instance can only be created through the static method "MLClass::CreateNewMLClass" the "XmlElementTemplate"
547  * template can not be used.
548  */
550  {
551  public:
552  XmlElementMLClass (XmlTagPtr tag,
553  XmlStream& s,
554  VolConstBool& cancelFlag,
555  RunLog& log
556  );
557 
558  virtual ~XmlElementMLClass ();
559 
560  MLClassPtr Value () const;
561 
563 
564  static
565  void WriteXML (const MLClass& mlClass,
566  const KKStr& varName,
567  std::ostream& o
568  );
569  private:
570  MLClassPtr value;
571  };
573 
574 
575 
576 
577  /**
578  *@brief Will only write the ClassName rather than complete MLClass instances
579  */
581  {
582  public:
583  XmlElementMLClassNameList (XmlTagPtr tag,
584  XmlStream& s,
585  VolConstBool& cancelFlag,
586  RunLog& log
587  );
588 
589  virtual ~XmlElementMLClassNameList ();
590 
591  MLClassListPtr Value () const;
592 
594 
595  static
596  void WriteXML (const MLClassList& mlClassList,
597  const KKStr& varName,
598  std::ostream& o
599  );
600  private:
601  MLClassListPtr value;
602  };
604 
605 
608 
609 
610 
611 } /* namespace KKMLL */
612 
613 
614 #endif
static void WriteXML(const MLClass &mlClass, const KKStr &varName, std::ostream &o)
Definition: MLClass.cpp:547
__int16 kkint16
16 bit signed integer.
Definition: KKBaseTypes.h:85
bool Mandatory() const
Definition: MLClass.h:149
MLClass * MLClassPtr
Definition: MLClass.h:46
void StoredOnDataBase(bool _storedOnDataBase)
Definition: MLClass.h:169
MLClassPtr Parent() const
Definition: MLClass.h:157
MLClassPtr GetUnKnownClass()
Return a pointer to the MLClass object that represents the unknown Class in the list.
Definition: MLClass.cpp:893
__int32 kkint32
Definition: KKBaseTypes.h:88
MLClassIndexList * MLClassIndexListPtr
Definition: MLClass.h:462
static MLClassListPtr MergeClassList(const MLClassList &list1, const MLClassList &list2)
Definition: MLClass.cpp:1245
Maintains a list of classes and their associated integer index.
Definition: MLClass.h:459
virtual void ReadXML(XmlStream &s, XmlTagConstPtr tag, VolConstBool &cancelFlag, RunLog &log)
Definition: MLClass.cpp:1703
KKStr ToCommaDelimitedStr() const
Definition: MLClass.cpp:970
GoalKeeper * GoalKeeperPtr
bool StoredOnDataBase() const
Definition: MLClass.h:167
MLClassPtr Value() const
Definition: MLClass.cpp:540
MLClassPtr GetNoiseClass() const
Definition: MLClass.cpp:875
KKStr ToCommaDelString() const
Returns string consisting of all contained classes indicating ClassIndex assigned to each class...
Definition: MLClass.cpp:1689
kkint16 GetClassIndex(MLClassPtr c)
Returns the corresponding index to the class &#39;c&#39;; if not in list will return -1.
Definition: MLClass.cpp:1621
KKStr ExtractHTMLTableHeader() const
Will generate a HTML formatted string that can be used in a HTML table.
Definition: MLClass.cpp:1195
MLClassIndexList(const MLClassIndexList &_list)
Definition: MLClass.cpp:1532
unsigned __int16 kkuint16
16 bit unsigned integer.
Definition: KKBaseTypes.h:86
float CountFactor() const
Definition: MLClass.h:139
static void ChangeNameOfClass(MLClassPtr mlClass, const KKStr &newName, bool &changeSuccessful)
Changes the name of an existing class verifying that a duplicate does not get created.
Definition: MLClass.cpp:181
Represents a "Class" in the Machine Learning Sense.
Definition: MLClass.h:52
void ExtractTwoTitleLines(KKStr &titleLine1, KKStr &titleLine2) const
Using the class names create two title lines where we split names by "_" characters between the two l...
Definition: MLClass.cpp:1035
static void WriteXML(const MLClassList &mlClassList, const KKStr &varName, std::ostream &o)
Definition: MLClass.cpp:1499
MLClassList operator-(const MLClassList &right) const
Definition: MLClass.cpp:1400
bool operator!=(const MLClassList &right) const
Definition: MLClass.cpp:1332
static KKStr GetClassNameFromDirName(const KKStr &subDir)
Definition: MLClass.cpp:372
bool UnDefined() const
Definition: MLClass.h:183
static MLClassPtr GetUnKnownClassStatic()
Definition: MLClass.cpp:261
bool Summarize() const
Definition: MLClass.h:171
MLClassPtr TakeOwnership()
kkint32 MemoryConsumedEstimated() const
Definition: MLClass.cpp:616
bool operator==(const MLClassList &right) const
Definition: MLClass.cpp:1313
XmlElementMLClassNameList(XmlTagPtr tag, XmlStream &s, VolConstBool &cancelFlag, RunLog &log)
Definition: MLClass.cpp:1438
virtual MLClassPtr LookUpByName(const KKStr &_name) const
Returns a pointer of MLClass object with name (_name); if none in list will then return NULL...
Definition: MLClass.cpp:830
const KKStr & ParentName() const
Definition: MLClass.cpp:354
void Parent(MLClassPtr _parent)
Definition: MLClass.h:158
virtual void WriteXML(const KKStr &varName, std::ostream &o) const
Definition: MLClass.cpp:1733
static void FinalCleanUp()
Call this as the last thing the application does, will delete all existing instances of &#39;MLClass&#39;...
Definition: MLClass.cpp:269
void CountFactor(float _countFactor)
Definition: MLClass.h:140
void Mandatory(bool _mandatory)
Definition: MLClass.h:150
KKStr ToCommaDelimitedQuotedStr() const
Definition: MLClass.cpp:985
MLClassPtr GetMLClass(kkint16 classIndex)
Locates the MLClass that was assigned classIndex.
Definition: MLClass.cpp:1636
void Description(const KKStr &_description)
Definition: MLClass.h:143
MLClassIndexList(const MLClassList &_classes)
Definition: MLClass.cpp:1544
void Save(KKStr _fileName, bool &_successfull)
Definition: MLClass.cpp:723
XmlElementMLClass(XmlTagPtr tag, XmlStream &s, VolConstBool &cancelFlag, RunLog &log)
Definition: MLClass.cpp:481
static MLClassListPtr BuildListFromDelimtedStr(const KKStr &s, char delimiter)
Definition: MLClass.cpp:1268
KKTHread * KKTHreadPtr
XmlElementTemplate< MLClassIndexList > XmlElementMLClassIndexList
Definition: MLClass.h:606
MLClassList & operator+=(const MLClassList &right)
Definition: MLClass.cpp:1362
virtual MLClassPtr PopFromFront()
Definition: MLClass.cpp:783
MLClassList & operator-=(const MLClassList &right)
Definition: MLClass.cpp:1340
void AddClass(MLClassPtr _ic, bool &_dupEntry)
Definition: MLClass.cpp:1576
MLClassListPtr ExtractMandatoryClasses() const
Definition: MLClass.cpp:1018
KKStr ToTabDelimitedStr() const
Definition: MLClass.cpp:955
virtual ~MLClassIndexList()
Definition: MLClass.h:468
kkint32 ClassId() const
Definition: MLClass.h:136
virtual void Clear()
Clears the contents of this list and updates nameIndex structure.
Definition: MLClass.cpp:623
XmlTag const * XmlTagConstPtr
Definition: KKStr.h:45
MLClassListPtr TakeOwnership()
Definition: MLClass.cpp:1491
Manages the reading and writing of objects in a simple XML format. For a class to be supported by Xml...
Definition: XmlStream.h:46
virtual ~XmlElementMLClass()
Definition: MLClass.cpp:534
kkuint16 NumHierarchialLevels() const
Definition: MLClass.cpp:419
virtual void PushOnBack(MLClassPtr mlClass)
Definition: MLClass.cpp:798
MLClassListPtr Value() const
Definition: MLClass.cpp:1484
static void ResetAllParentsToAllClasses()
Definition: MLClass.cpp:229
static KKStr Concat(const std::vector< std::string > &values)
Concatenates the list of &#39;std::string&#39; strings.
Definition: KKStr.cpp:1082
MLClassList(const KKStr &fileName, bool &successfull)
Construct a MLClassList object from the contents of a file.
Definition: MLClass.cpp:588
void ExtractThreeTitleLines(KKStr &titleLine1, KKStr &titleLine2, KKStr &titleLine3) const
Using the class names create three title lines where we split names by "_" characters between the thr...
Definition: MLClass.cpp:1068
KKB::kkuint16 NumHierarchialLevels() const
Definition: MLClass.cpp:668
void AddClassIndexAssignment(MLClassPtr _ic, kkint16 _classIndex, bool &_dupEntry)
Definition: MLClass.cpp:1598
XmlElementMLClassIndexList * XmlElementMLClassIndexListPtr
Definition: MLClass.h:607
MLClassListPtr ExtractListOfClassesForAGivenHierarchialLevel(kkint32 level)
Definition: MLClass.cpp:1223
const KKStr & UpperName() const
Definition: MLClass.h:155
MLClassList & operator=(const MLClassList &right)
Definition: MLClass.cpp:1381
void ParseClassIndexList(const KKStr &s, RunLog &log)
Definition: MLClass.cpp:1649
const KKStr & Name() const
Definition: MLClass.h:154
void ClassId(kkint32 _classId)
Definition: MLClass.h:137
virtual MLClassPtr LookUpByClassId(kkint32 _classId) const
Definition: MLClass.cpp:843
virtual ~MLClassList()
Definition: MLClass.cpp:609
static MLClassPtr CreateNewMLClass(const KKStr &_name, kkint32 _classId=-1)
Static method used to create a new instance of a MLClass object.
Definition: MLClass.cpp:100
void WriteXML(const KKStr &varName, std::ostream &o) const
Definition: MLClass.cpp:1286
MLClassList(const MLClassList &_mlClasses)
Copy constructor; will copy list but not own the contents.
Definition: MLClass.cpp:570
friend std::ostream & operator<<(std::ostream &os, const Matrix &matrix)
KKStr ToString() const
Definition: MLClass.cpp:364
void Summarize(bool _summarize)
Definition: MLClass.h:177
virtual MLClassPtr PopFromBack()
Definition: MLClass.cpp:768
void ExtractThreeTitleLines(KKStr &titleLine1, KKStr &titleLine2, KKStr &titleLine3, kkint32 fieldWidth) const
Definition: MLClass.cpp:1130
static MLClassListPtr BuildListOfDecendents(MLClassPtr parent)
Definition: MLClass.cpp:145
KKStr & operator=(const KKStr &src)
Definition: KKStr.cpp:1390
Used for logging messages.
Definition: RunLog.h:49
void EncodeProblem(const struct svm_paramater &param, struct svm_problem &prob_in, struct svm_problem &prob_out)
void Load(const KKStr &_fileName, bool &_successfull)
Definition: MLClass.cpp:681
MLClassList * MLClassListPtr
Definition: MLClass.h:49
void WriteXML(const KKStr &varName, std::ostream &o) const
Definition: MLClass.cpp:448
virtual MLClassPtr GetMLClassPtr(const KKStr &_name)
return pointer to instance with &#39;_name&#39;; if none exists, create one and add to list.
Definition: MLClass.cpp:861
static MLClassListPtr GlobalClassList()
Definition: MLClass.cpp:50
void UnDefined(bool _unDefined)
Definition: MLClass.h:184
kkint32 MemoryConsumedEstimated() const
Definition: MLClass.cpp:1569
const KKStr & Description() const
Definition: MLClass.h:142
MLClassListPtr ExtractSummarizeClasses() const
Definition: MLClass.cpp:1001
KKStr ToString() const
Definition: MLClass.cpp:937
XmlElementMLClass * XmlElementMLClassPtr
Definition: MLClass.h:572
Maintains a list of MLClass instances.
Definition: MLClass.h:233
virtual void PushOnFront(MLClassPtr mlClass)
Definition: MLClass.cpp:811
virtual void AddMLClass(MLClassPtr _mlClass)
Definition: MLClass.cpp:756
Will only write the ClassName rather than complete MLClass instances.
Definition: MLClass.h:580
static MLClassPtr GetByClassId(kkint32 _classId)
Definition: MLClass.cpp:137
MLClassPtr MLClassForGivenHierarchialLevel(KKB::kkuint16 level) const
Definition: MLClass.cpp:427
bool IsAnAncestor(MLClassPtr c) const
Definition: MLClass.cpp:405
MLClassList globalClassList
virtual void Clear()
Definition: MLClass.cpp:1558
XmlElementMLClassNameList * XmlElementMLClassNameListPtr
Definition: MLClass.h:603
volatile const bool VolConstBool
Definition: KKBaseTypes.h:163