HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RAY_StylerInfo.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: RAY library (C++)
7  *
8  * COMMENTS: This contains styler information, along with the parent
9  * styler and subject used to create the styler. This allows
10  * updating the parent styler and automatically rebuilding the
11  * child styler.
12  *
13  */
14 
15 #ifndef __RAY_StylerInfo_H__
16 #define __RAY_StylerInfo_H__
17 
18 #include "RAY_API.h"
19 #include <UT/UT_IntrusivePtr.h>
20 #include <UT/UT_SharedPtr.h>
21 #include <STY/STY_Styler.h>
22 #include <STY/STY_Subject.h>
24 
26 {
27 public:
29 
31  RAY_StylerInfo(const STY_Styler &parent_styler,
32  const STY_SubjectHandle &subject);
33  RAY_StylerInfo(const STY_Styler &parent_styler,
34  const UT_Array<STY_SubjectHandle> &subjects);
35  ~RAY_StylerInfo();
36 
37  const STY_Styler &getStyler() const;
38  void updateStyler(const STY_Styler &new_parent_styler);
39  void setParentAndSubject(const STY_Styler &styler,
40  const STY_SubjectHandle &subject);
41  void setParentAndSubjects(const STY_Styler &styler,
42  const UT_Array<STY_SubjectHandle> &subjects);
43  void addSubject(const STY_SubjectHandle &subject);
44  void clear();
45 
47  { myGroupSharingHolder = g; }
48 
49 private:
50  class StylerInfoData;
51  class StylerInfoData
52  : public UT_IntrusiveRefCounter<StylerInfoData>
53  {
54  public:
55  StylerInfoData();
56  ~StylerInfoData();
57  void rebuildStyler();
58 
59  STY_Styler myParentStyler;
60  UT_Array<STY_SubjectHandle> mySubjects;
61  STY_Styler myStyler;
62  };
63  typedef UT_IntrusivePtr<StylerInfoData> StylerInfoDataHandle;
64  SharedPrimGroup myGroupSharingHolder;
65 
66  void createUnsharedStylerInfoData()
67  {
68  if (!myData)
69  myData.reset(new StylerInfoData());
70  else if (myData->use_count() > 1)
71  myData.reset(new StylerInfoData(*myData));
72  }
73 
74  StylerInfoDataHandle myData;
75 };
76 
77 #endif
GLboolean GLboolean g
Definition: glcorearb.h:1222
UT_SharedPtr< GSTY_SubjectPrimGroup > SharedPrimGroup
A reference counter base class for use with UT_IntrusivePtr.
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:36
Wrapper around hboost::intrusive_ptr.
#define RAY_API
Definition: RAY_API.h:12
void setGroupSharingHolder(const SharedPrimGroup &g)