Slicer  4.10
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkPersonInformation.h
Go to the documentation of this file.
1 /*=auto=========================================================================
2 
3  Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH) All Rights Reserved.
4 
5  See COPYRIGHT.txt
6  or http://www.slicer.org/copyright/copyright.txt for details.
7 
8 =========================================================================auto=*/
9 
13 
14 #ifndef __vtkPersonInformation_h
15 #define __vtkPersonInformation_h
16 
17 #include "vtkAddon.h"
18 
19 #include <vtkObject.h>
20 #include <vtkStringArray.h>
21 
22 #include <map>
23 
24 class VTK_ADDON_EXPORT vtkPersonInformation : public vtkObject
25 {
26 public:
27  static vtkPersonInformation *New();
28  vtkTypeMacro(vtkPersonInformation,vtkObject);
29  virtual void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
30 
31  // Description:
32  // Set/Get username.
33  // Set method
34  virtual bool SetName(const std::string& value);
35  virtual std::string GetName();
36 
37  virtual bool SetLogin(const std::string& value);
38  virtual std::string GetLogin();
39 
40  virtual bool SetEmail(const std::string& value);
41  virtual std::string GetEmail();
42 
43  virtual bool SetOrganization(const std::string& value);
44  virtual std::string GetOrganization();
45 
46  virtual bool SetOrganizationRole(const std::string& value);
47  virtual std::string GetOrganizationRole();
48 
49  virtual bool SetProcedureRole(const std::string& value);
50  virtual std::string GetProcedureRole();
51 
52  // Description:
53  // Make a full, independent copy of another object into this object.
54  virtual void DeepCopy(vtkPersonInformation* source);
55 
56  // Description:
57  // Set a custom string value. Calls Modified() if the value is different from the previous value.
58  // No validation is performed. If a standard string's key is used (Name, Email, ...)
59  // then the standard string is overwritten without validation.
60  // If value is set to empty then the key/value pair is deleted.
61  virtual void SetCustomString(const std::string& key, const std::string& value);
62 
63  // Description:
64  // Get a custom string value.
65  // If a standard string's key is used (Name, Email, ...) then the corresponding value is returned.
66  // Empty string is returned if the key has no associated value.
67  virtual std::string GetCustomString(const std::string& key);
68 
69  virtual bool IsEmailValid(const std::string& value);
70 
71  // Description:
72  // Information keys.
73  static const char* KeyName() { return "Name"; };
74  static const char* KeyLogin() { return "Login"; };
75  static const char* KeyEmail() { return "Email"; };
76  static const char* KeyOrganization() { return "Organization"; };
77  static const char* KeyOrganizationRole() { return "OrganizationRole"; };
78  static const char* KeyProcedureRole() { return "ProcedureRole"; };
79 
80  // Description:
81  // Write all key/value pairs to a string.
82  virtual std::string GetAsString();
83 
84  // Description:
85  // Read all key/value pairs from a string.
86  // All previous values are cleared.
87  virtual bool SetFromString(const std::string& data);
88 
89  // Description:
90  // Returns list of all keys.
91  virtual void GetKeys(vtkStringArray *keys);
92 
93 protected:
96 
97  std::string EncodeString(const std::string& value);
98  std::string DecodeString(const std::string& value);
99 
100  std::map<std::string, std::string> Data;
101 
102 private:
103  vtkPersonInformation(const vtkPersonInformation&); // Not implemented.
104  void operator=(const vtkPersonInformation&); // Not implemented.
105 };
106 
107 #endif
static const char * KeyOrganizationRole()
static const char * KeyName()
static const char * KeyEmail()
static const char * KeyOrganization()
std::map< std::string, std::string > Data
static const char * KeyProcedureRole()
static const char * KeyLogin()
vtkPersonInformation - specify name and other information to identify a person.