computerpicker.hpp 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. /////////////////////////////////////////////////////////////////////////////
  14. //
  15. // ComputerPicker.h : interface of the CComputerPicker class
  16. //
  17. /////////////////////////////////////////////////////////////////////////////
  18. #if !defined(AFX_DEPLOYUTILS_COMPUTERPICKER_HPP__INCLUDED_)
  19. #define AFX_DEPLOYUTILS_COMPUTERPICKER_HPP__INCLUDED_
  20. #if _MSC_VER > 1000
  21. #pragma once
  22. #endif // _MSC_VER > 1000
  23. #include <string>
  24. #include <vector>
  25. #include <map>
  26. #include "jptree.hpp"
  27. typedef std::vector<std::string> stringarray;
  28. typedef std::vector<IPropertyTree*> IPropertyTreePtrArray;
  29. class MapStrToChar : public std::map<std::string, char>
  30. {
  31. };
  32. class MapStrToStrArray : public std::map<std::string, stringarray>
  33. {
  34. };
  35. //---------------------------------------------------------------------------
  36. // CComputerPicker class declaration
  37. //---------------------------------------------------------------------------
  38. class CComputerPicker
  39. {
  40. // Construction
  41. public:
  42. CComputerPicker(); // standard constructor
  43. virtual ~CComputerPicker();
  44. public:
  45. void SetRootNode(const IPropertyTree* pNode);
  46. void Refresh();
  47. const IPropertyTree* getComputerTree(){return m_pComputerTree;}
  48. const IPropertyTree* getFilterTree(){return m_pFilterTree;}
  49. private:
  50. static void CreateComponentTypePrefixMap();
  51. static char GetPrefixForComponentType(const char* componType);
  52. static const char* GetComponentTypeForPrefix(char chPrefix);
  53. void ResetUsageMap();
  54. void NoteUsage(const char *computer, const char* componType, const char *name, char status='+');
  55. bool GetUsage(const char *computer, StringBuffer& sUsage, bool bIncludeComponentType) const;
  56. void CreateComputerFilterTree();
  57. void NoteFilter(IPropertyTree* pFilter, const char *componentType,
  58. const char *component, const char* computer);
  59. void ApplyFilter(const char* szSubTreeName, const char* szIncAttrib,
  60. char chStatus, StringBuffer& sFilterApplied);
  61. private:
  62. static MapStrToChar s_prefixMap;
  63. MapStrToStrArray m_usageMap;
  64. Owned<IPropertyTree> m_pFilterTree;
  65. Owned<IPropertyTree> m_pComputerTree;
  66. const IPropertyTree* m_pRootNode;
  67. };
  68. //---------------------------------------------------------------------------
  69. //{{AFX_INSERT_LOCATION}}
  70. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  71. #endif // !defined(AFX_DEPLOYUTILS_COMPUTERPICKER_HPP__INCLUDED_)