sprk_hca.h
1 // Copyright (c) Tech Soft 3D, Inc.
2 //
3 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc.,
4 // and considered a trade secret as defined under civil and criminal statutes.
5 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of
6 // unauthorized use or misappropriation of its trade secrets. Use of this information
7 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under
8 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use.
9 
10 #ifndef SPRK_HCA_H
11 #define SPRK_HCA_H
12 
13 #include "sprk.h"
14 
15 #ifdef _MSC_VER
16 #ifndef STATIC_APP
17 # ifdef SPRK_HCA
18 # define HPS_HCA_API __declspec (dllexport)
19 # else
20 # define HPS_HCA_API __declspec (dllimport)
21 # endif
22 #endif
23 #else
24 # include <stddef.h>
25 #endif
26 
27 #ifndef HPS_HCA_API
28 # define HPS_HCA_API
29 #endif
30 
31 #include <mutex>
32 #include <vector>
33 
34 namespace HPS
35 {
37 class HPS_HCA_API HCA
38 {
39 public:
40 
42  class HPS_HCA_API ImportNotifier : public IONotifier
43  {
44  public:
47 
50  ImportNotifier(ImportNotifier const & in_that);
51 
56  ImportNotifier(IONotifier const & in_that);
57 
61  ImportNotifier(ImportNotifier && in_that);
62 
66  ImportNotifier & operator=(ImportNotifier && in_that);
67 
68  virtual ~ImportNotifier();
69 
70  static const HPS::Type staticType = HPS::Type::HCAImportNotifier;
71  HPS::Type ObjectType() const { return staticType; };
72 
76  ImportNotifier & operator=(ImportNotifier const & in_that);
77 
80  void Assign(ImportNotifier const & in_that);
81 
85  HPS::Model & GetTarget() const;
86  };
87 
89  class HPS_HCA_API ImportOptionsKit : public HPS::Sprocket
90  {
91  public:
94 
97  ImportOptionsKit(ImportOptionsKit const & in_kit);
98 
103 
107  ImportOptionsKit & operator=(ImportOptionsKit && in_that);
108 
109  virtual ~ImportOptionsKit();
110 
111  static const HPS::Type staticType = HPS::Type::HCAImportOptionsKit;
112  HPS::Type ObjectType() const { return staticType; }
113 
117  static ImportOptionsKit GetDefault();
118 
121  void Set(ImportOptionsKit const & in_kit);
122 
125  void Show(ImportOptionsKit & out_kit) const;
126 
130  ImportOptionsKit & operator=(ImportOptionsKit const & in_kit);
131 
134  bool Empty() const;
135 
139  bool Equals(ImportOptionsKit const & in_kit) const;
140 
144  bool operator==(ImportOptionsKit const & in_kit) const;
145 
149  bool operator!=(ImportOptionsKit const & in_kit) const;
150 
156  ImportOptionsKit & SetTarget(HPS::Model const & in_target);
157 
162  ImportOptionsKit & SetView(HPS::View const & in_view);
163 
169  ImportOptionsKit & SetJavascriptPath(HPS::UTF8 const & javascript_path);
170 
174  bool ShowTarget(HPS::Model & out_model) const;
175 
179  bool ShowView(HPS::View & out_view) const;
180 
184  bool ShowJavascriptPath(HPS::UTF8 & out_javascript_path) const;
185 
188  ImportOptionsKit & UnsetTarget();
189 
192  ImportOptionsKit & UnsetView();
193 
196  ImportOptionsKit & UnsetJavascriptPath();
197 
200  ImportOptionsKit & UnsetEverything();
201  };
202 
204  class HPS_HCA_API NetworkImportOptionsKit : public HPS::Sprocket
205  {
206  public:
209 
213 
218 
222  NetworkImportOptionsKit & operator=(NetworkImportOptionsKit && in_that);
223 
224  virtual ~NetworkImportOptionsKit();
225 
226  static const HPS::Type staticType = HPS::Type::HCANetworkImportOptionsKit;
227  HPS::Type ObjectType() const { return staticType; }
228 
232  static NetworkImportOptionsKit GetDefault();
233 
236  void Set(NetworkImportOptionsKit const & in_kit);
237 
240  void Show(NetworkImportOptionsKit & out_kit) const;
241 
245  NetworkImportOptionsKit & operator=(NetworkImportOptionsKit const & in_kit);
246 
249  bool Empty() const;
250 
254  bool Equals(NetworkImportOptionsKit const & in_kit) const;
255 
259  bool operator==(NetworkImportOptionsKit const & in_kit) const;
260 
264  bool operator!=(NetworkImportOptionsKit const & in_kit) const;
265 
271  NetworkImportOptionsKit & SetTarget(HPS::Model const & in_target);
272 
277  NetworkImportOptionsKit & SetView(HPS::View const & in_view);
278 
284  NetworkImportOptionsKit & SetJavascriptPath(HPS::UTF8 const & javascript_path);
285 
290  NetworkImportOptionsKit & SetNetworkPath(HPS::UTF8 const & network_path);
291 
296  NetworkImportOptionsKit & SetModelBoundingPreviews(bool model_bounding_previews);
297 
302  NetworkImportOptionsKit & SetEjectedGeometryBoundingPreviews(bool ejected_geometry_bounding_previews);
303 
309  NetworkImportOptionsKit & SetLimitMiB(uint32_t limit_MiB);
310 
311 
315  bool ShowTarget(HPS::Model & out_model) const;
316 
320  bool ShowView(HPS::View & out_view) const;
321 
325  bool ShowJavascriptPath(HPS::UTF8 & out_javascript_path) const;
326 
330  bool ShowNetworkPath(HPS::UTF8 & out_network_path) const;
331 
335  bool ShowModelBoundingPreviews(bool & out_model_bounding_previews) const;
336 
340  bool ShowEjectedGeometryBoundingPreviews(bool & out_ejected_geometry_bounding_previews) const;
341 
345  bool ShowLimitMiB(uint32_t & out_limit_MiB) const;
346 
347 
350  NetworkImportOptionsKit & UnsetTarget();
351 
354  NetworkImportOptionsKit & UnsetView();
355 
358  NetworkImportOptionsKit & UnsetJavascriptPath();
359 
362  NetworkImportOptionsKit & UnsetNetworkPath();
363 
366  NetworkImportOptionsKit & UnsetModelBoundingPreviews();
367 
370  NetworkImportOptionsKit & UnsetEjectedGeometryBoundingPreviews();
371 
374  NetworkImportOptionsKit & UnsetLimitMiB();
375 
378  NetworkImportOptionsKit & UnsetEverything();
379  };
380 
381 
383  class HPS_HCA_API File
384  {
385  public:
395  static ImportNotifier Import(char const * in_file_name, ImportOptionsKit const & in_options);
396 
405  static ImportNotifier Import(char const * in_file_name, NetworkImportOptionsKit const & in_options);
406 
407  private:
409  File();
410  };
411 
413  class HPS_HCA_API RequestIdEvent : public Event
414  {
415  public:
416 
419  {
420  channel = GetClassID();
421  consumable = false;
422  }
423 
424  RequestIdEvent(uint32_t in_request_id) : Event(), request_id(in_request_id)
425  {
426  channel = GetClassID();
427  consumable = false;
428  }
429 
432  RequestIdEvent(Event const & in_event) : Event(in_event)
433  {
434  if (in_event.GetChannel() == Object::ClassID<RequestIdEvent>())
435  {
436  auto that = static_cast<RequestIdEvent const &>(in_event);
437  request_id = that.request_id;
438  }
439  else
440  throw HPS::InvalidSpecificationException("Invalid Event Type to Cast From.");
441  }
442 
443  virtual ~RequestIdEvent();
444 
447  Event * Clone() const override
448  {
449  RequestIdEvent * new_event = new RequestIdEvent(*this);
450  return new_event;
451  }
452 
453  uint32_t request_id;
454  };
455 
456  class ModelTreeItem;
457  class ModelTree;
458 
459  typedef ::std::shared_ptr<ModelTreeItem> ModelTreeItemPtr;
460  typedef ::std::shared_ptr<ModelTree> ModelTreePtr;
461 
462 
464  class HPS_HCA_API Model {
465 
466  public:
467 
469  Model();
470 
473  Model(HPS::Model const & in_model);
474 
477  Model(Model const & that);
478 
481  Model(Model&& that);
482 
483  ~Model();
484 
488  bool Equals(Model const & other) const;
489 
493  bool operator== (Model const & other) const;
494 
498  bool operator!= (Model const & other) const;
499 
503  Model& operator=(Model&& other);
504 
507  bool Empty();
508 
513  bool ShowRootNode(int64_t & out_node_id);
514 
520  bool ShowNodeName(int64_t in_node_id, HPS::UTF8 & out_name);
521 
527  bool ShowNodeChildren(int64_t in_node_id, HPS::Int64Array & out_ids);
528 
534  bool ShowNodeParent(int64_t in_node_id, int64_t & out_parent_id);
535 
544  bool RequestNodeProperties(int64_t in_node_id, uint32_t & out_request_id);
545 
560  bool RetrieveNodeProperties(uint32_t in_request_id, uint32_t in_timeout_ms, int64_t & out_node_id, bool & out_valid, HPS::UTF8Array & out_keys, HPS::UTF8Array & out_values);
561 
566  bool ShowNodeFromKeyPath(HPS::KeyPath const & in_key_path, int64_t & out_node_id);
567 
572  void Show(HPS::Canvas const & in_canvas, int64_t in_node_id);
573 
578  void Hide(HPS::Canvas const & in_canvas, int64_t in_node_id);
579 
584  void Unhighlight(HPS::Canvas const & in_canvas, int64_t in_node_id);
585 
591  void Highlight(HPS::Canvas const & in_canvas, HighlightOptionsKit const & in_highlight_options, int64_t in_node_id);
592 
599  void Highlight(HPS::Canvas const & in_canvas, HighlightOptionsKit const & in_highlight_options, HPS::Int64Array const & in_node_ids);
600 
605  void Isolate(HPS::Canvas const & in_canvas, int64_t in_node_id);
606 
611  void Zoom(HPS::Canvas const & in_canvas, int64_t in_node_id);
612 
616  void ShowAll(HPS::Canvas const & in_canvas);
617 
622  bool IsHidden(int64_t in_node_id);
623 
628  bool IsHighlighted(int64_t in_node_id);
629 
632  void OnHighlightUnhighlight();
633 
637  void UnhighlightAll(HPS::Canvas const & in_canvas);
638 
639  private:
640 
641  friend class ModelTreeItem;
643  Model(void * in_opaque);
644  void * opaque;
645  };
646 
649  class HPS_HCA_API ModelTree : public Sprocket
650  {
651  public:
654  enum class ItemType
655  {
656  None,
657  Model,
658  Node,
659  };
660 
662  ModelTree();
663 
668  ModelTree(Canvas const & in_canvas, HCA::Model & hca_model);
669 
672  ModelTree(ModelTree const & in_that);
673 
676  ModelTree(ModelTree && in_that);
677 
678  virtual ~ModelTree();
679 
680  static const HPS::Type staticType = HPS::Type::HCAModelTree;
681  virtual HPS::Type ObjectType() const { return staticType; }
682 
686  ModelTree & operator=(ModelTree const & in_that);
687 
691  ModelTree & operator=(ModelTree && in_that);
692 
696  virtual void Assign(ModelTree const & in_that);
697 
701  bool Equals(ModelTree const & in_that) const;
702 
706  bool operator!=(ModelTree const & in_that) const;
707 
711  bool operator==(ModelTree const & in_that) const;
712 
713 
720  void SetRoot(ModelTreeItemPtr const & in_root);
721 
724  ModelTreeItemPtr GetRoot() const;
725 
728  HCA::Model & GetHCAModel() const;
729 
732  HPS::Canvas & GetCanvas() const;
733 
737  virtual void Flush();
738  };
739 
740 
743  class HPS_HCA_API ModelTreeItem : public Sprocket
744  {
745  public:
747  ModelTreeItem();
748 
751  ModelTreeItem(ModelTreeItem const & in_that);
752 
755  ModelTreeItem(ModelTreeItem && in_that);
756 
760  ModelTreeItem(ModelTreePtr const & in_tree, HCA::Model const & in_hca_model);
761 
766  ModelTreeItem(ModelTreePtr const & in_tree, int64_t in_node_id);
767 
768  virtual ~ModelTreeItem();
769 
770  static const HPS::Type staticType = HPS::Type::HCAModelTreeItem;
771  HPS::Type ObjectType() const { return staticType; }
772 
776  ModelTreeItem & operator=(ModelTreeItem const & in_that);
777 
781  ModelTreeItem & operator=(ModelTreeItem && in_that);
782 
786  virtual void Assign(ModelTreeItem const & in_that);
787 
791  bool Equals(ModelTreeItem const & in_that) const;
792 
796  bool operator!=(ModelTreeItem const & in_that) const;
797 
801  bool operator==(ModelTreeItem const & in_that) const;
802 
803 
806  ModelTreePtr GetTree() const;
807 
810  UTF8 GetTitle() const;
811 
814  ModelTree::ItemType GetItemType() const;
815 
818  bool HasChildren() const;
819 
820 
828  virtual ModelTreeItemPtr AddChild(int64_t in_node_id) = 0;
829 
830 
833  virtual void Expand();
834 
837  virtual void Collapse();
838 
839 
842  uint64_t GetNodeId() const;
843 
846  bool IsHidden() const;
847 
853  virtual void OnShowHide() {};
854 
858  void Hide();
859 
863  void Show();
864 
868  void Isolate();
869 
871  void Zoom();
872 
875  bool IsExpanded() const;
876 
879  bool IsHighlighted() const;
880 
886  virtual void OnHighlightUnhighlight();
887 
890  void Highlight(HighlightOptionsKit const & in_highlight_options);
891 
894  void Unhighlight();
895 
896  /* Requests properties for this ModelTreeItem
897  * When the request has been fulfilled, an event of type HCA::RequestIdEvent will be injected to the Database's Event Dispatcher.
898  * Registering a handler to HCA::RequestIdEvent will allow the user to know when this request has completed.
899  * The value of HCA::RequestIdEvent::request_id object will match out_requested_id, returned by this function.
900  * Properties requested with this function can be inspected through a call to HCA::Model::RetrieveNodeProperties after the request
901  * associated with out_request_id completes.
902  * \param out_request_id an ID which uniquely identifies this request
903  * \return <span class='code'>true</span> if the node's properties were gathered successfully, <span class='code'>false</span> otherwise. */
904  bool RequestProperties(uint32_t & out_request_id);
905  };
906 
907 private:
909  HCA();
910 };
911 
912 }
913 
914 #endif
Definition: hps.h:85
Definition: sprk_hca.h:464
Definition: sprk.h:1102
An InvalidSpecificationException is thrown when a method is called with non-sensical or contradictory...
Definition: hps.h:6118
Definition: sprk.h:68
Definition: sprk.h:936
intptr_t GetChannel() const
Definition: hps.h:6631
Definition: sprk_hca.h:89
Definition: sprk_hca.h:743
Definition: sprk_hca.h:413
HPS::Type ObjectType() const
Definition: sprk_hca.h:112
HPS::Type ObjectType() const
Definition: sprk_hca.h:227
RequestIdEvent()
Definition: sprk_hca.h:418
Definition: sprk_hca.h:204
Definition: sprk_hca.h:383
Definition: sprk_hca.h:649
HPS::Type ObjectType() const
Definition: sprk_hca.h:71
Definition: hps.h:7396
Event * Clone() const override
Definition: sprk_hca.h:447
Definition: hps.h:49395
Definition: hps.h:45771
Definition: hps.h:6598
std::vector< UTF8, Allocator< UTF8 > > UTF8Array
Array of type HPS::UTF8.
Definition: hps.h:6948
HPS::Type ObjectType() const
Definition: sprk_hca.h:771
Definition: sprk.h:1317
std::vector< int64_t, HPS::Allocator< int64_t > > Int64Array
Array of type int64_t.
Definition: hps.h:6996
virtual void OnShowHide()
Definition: sprk_hca.h:853
Definition: hps.h:9675
virtual HPS::Type ObjectType() const
Definition: sprk_hca.h:681
RequestIdEvent(Event const &in_event)
Definition: sprk_hca.h:432
Definition: sprk_hca.h:42
ItemType
Definition: sprk_hca.h:654
Definition: sprk_hca.h:37