Minsky
schema2::Item Struct Reference

#include <schema2.h>

Inheritance diagram for schema2::Item:
Inheritance graph
Collaboration diagram for schema2::Item:
Collaboration graph

Public Member Functions

 Item ()
 
 Item (const schema1::Item &it)
 
 Item (const schema1::Operation &it)
 
 Item (const schema1::Variable &it)
 
 Item (const schema1::Godley &it)
 
 Item (const schema1::Plot &it)
 
 Item (const schema1::Group &it)
 
 Item (const schema1::Switch &it)
 
void addLayout (const schema1::UnionLayout &layout)
 
- Public Member Functions inherited from schema2::ItemBase
 ItemBase ()
 
 ItemBase (int id, const minsky::Item &it, const std::vector< int > &ports)
 
 ItemBase (const schema1::Item &it, const std::string &type="Item")
 
- Public Member Functions inherited from minsky::PlotOptions< Note >
 PlotOptions ()=default
 
 PlotOptions (const Note &x)
 
PlotOptionsoperator= (const PlotWidget &plot)
 
void applyPlotOptions (PlotWidget &plot) const
 

Public Attributes

Optional< float > width
 
Optional< float > height
 
Optional< std::string > name
 
Optional< std::string > init
 
Optional< std::string > units
 
Optional< Sliderslider
 
Optional< int > intVar
 
Optional< std::map< double, double > > dataOpData
 
Optional< std::string > filename
 
Optional< RavelStateravelState
 
Optional< int > lockGroup
 
Optional< minsky::Dimensions > dimensions
 
Optional< std::string > axis
 
Optional< double > arg
 
Optional< std::vector< std::vector< std::string > > > data
 
Optional< std::vector< minsky::GodleyAssetClass::AssetClass > > assetClasses
 
Optional< float > iconScale
 
Optional< std::vector< minsky::Bookmark > > bookmarks
 
Optional< classdesc::CDATA > tensorData
 
Optional< std::vector< ecolab::Plot::LineStyle > > palette
 
- Public Attributes inherited from schema2::ItemBase
int id =-1
 
std::string type
 
float x =0
 
float y =0
 position in canvas, or within group More...
 
float zoomFactor =1
 
double rotation =0
 rotation of icon, in degrees More...
 
std::vector< int > ports
 
- Public Attributes inherited from minsky::PlotOptions< Note >
Optional< std::string > name
 
Optional< bool > logx
 
Optional< bool > logy
 
Optional< bool > ypercent
 
Optional< bool > grid
 
Optional< bool > subgrid
 
Optional< minsky::PlotWidget::PlotType > plotType
 
Optional< std::string > xlabel
 
Optional< std::string > ylabel
 
Optional< std::string > y1label
 
Optional< int > nxTicks
 
Optional< int > nyTicks
 
Optional< double > xtickAngle
 
Optional< double > exp_threshold
 
double xmin
 
double xmax
 
double ymin
 
double ymax
 
double y1min
 
double y1max
 
unsigned symbolEvery
 
Optional< ecolab::Plot::Side > legend
 
Optional< LegendGeometrylegendGeometry
 
Optional< std::vector< ecolab::Plot::LineStyle > > palette
 
Optional< std::vector< std::string > > horizontalMarkers
 
Optional< std::vector< std::string > > verticalMarkers
 

Detailed Description

Definition at line 94 of file schema2.h.

Constructor & Destructor Documentation

◆ Item() [1/8]

schema2::Item::Item ( )
inline

Definition at line 119 of file schema2.h.

119 {}

◆ Item() [2/8]

schema2::Item::Item ( const schema1::Item it)
inline

Definition at line 121 of file schema2.h.

121 : ItemBase(it) {}

◆ Item() [3/8]

schema2::Item::Item ( const schema1::Operation it)
inline

Definition at line 124 of file schema2.h.

References minsky::OperationType::constant, TCLcmd::trap::init, schema1::Operation::intVar, schema1::Operation::ports, minsky::to_string(), schema1::Operation::type, and schema1::Operation::value.

124  :
125  ItemBase(it, "Operation:"+minsky::OperationType::typeName(it.type)),
126  name(it.name), dataOpData(it.data) {
127  if (it.intVar>-1) intVar=it.intVar;
128  ports=it.ports;
129  // rewrite deprecated constants as variables
131  {
132  type="Variable:constant";
133  init.reset(new std::string(std::to_string(it.value)));
134  }
135  }
Optional< std::map< double, double > > dataOpData
Definition: schema2.h:102
std::string type
Definition: schema2.h:71
minsky::OperationType::Type type
Definition: schema1.h:123
map< double, double > data
Definition: schema1.h:126
Optional< std::string > init
Definition: schema2.h:98
static std::string typeName(int type)
return the symbolic name of type
std::vector< int > ports
Definition: schema2.h:75
Optional< std::string > name
Definition: schema2.h:97
string to_string(CONST84 char *x)
Definition: minskyTCLObj.h:33
Optional< int > intVar
Definition: schema2.h:101
vector< int > ports
Definition: schema1.h:125
Here is the call graph for this function:

◆ Item() [4/8]

schema2::Item::Item ( const schema1::Variable it)
inline

Definition at line 136 of file schema2.h.

References schema1::Variable::ports.

136  :
137  ItemBase(it, "Variable:"+minsky::VariableType::typeName(it.type)),
138  name(it.name), init(it.init) {ports=it.ports;}
Optional< std::string > init
Definition: schema2.h:98
static std::string typeName(int t)
Definition: variableType.cc:30
std::vector< int > ports
Definition: schema2.h:75
Optional< std::string > name
Definition: schema2.h:97
vector< int > ports
Definition: schema1.h:141
minsky::VariableType::Type type
Definition: schema1.h:139

◆ Item() [5/8]

schema2::Item::Item ( const schema1::Godley it)

Definition at line 89 of file schema2.cc.

References assetClasses, minsky::FlowCoef::coef, data, schema1::Godley::doubleEntryCompliant, minsky::FlowCoef::name, schema2::ItemBase::ports, schema1::Godley::ports, and minsky::FlowCoef::str().

89  :
90  ItemBase(it, "GodleyIcon"),
92  {
93  typedef minsky::GodleyAssetClass::AssetClass AssetClass;
94  ports=it.ports;
95  // strip off leading :, since in schema 1, all godley tables are global
96  for (auto& i: *data)
97  for (auto& j: i)
98  {
99  minsky::FlowCoef fc(j);
100  if (fc.coef==0)
101  j="";
102  else
103  {
104  if (fc.name.length()>0 && fc.name[0]==':')
105  fc.name=fc.name.substr(1);
106  j=fc.str();
107  }
108  }
109 
110  // in doubleEntry mode, schema1 got the accounting equation wrong.
111  if (it.doubleEntryCompliant)
112  {
113  for (size_t r=1; r<data->size(); ++r)
114  for (size_t c=1; c<(*data)[r].size(); ++c)
115  if (!(*data)[r][c].empty() &&
116  ((*assetClasses)[c]==AssetClass::liability || (*assetClasses)[c]==AssetClass::equity))
117  {
118  minsky::FlowCoef fc((*data)[r][c]);
119  fc.coef*=-1;
120  (*data)[r][c]=fc.str();
121  }
122  }
123  else
124  {
125  // make all columns assets
126  assetClasses->resize((*data)[0].size());
127  for (auto& i: *assetClasses) i=AssetClass::asset;
128  }
129  }
vector< minsky::GodleyTable::AssetClass > assetClasses
Definition: schema1.h:191
Optional< std::vector< minsky::GodleyAssetClass::AssetClass > > assetClasses
Definition: schema2.h:112
bool doubleEntryCompliant
Definition: schema1.h:188
std::vector< int > ports
Definition: schema2.h:75
represents a numerical coefficient times a variable (a "flow")
Definition: flowCoef.h:27
vector< int > ports
Definition: schema1.h:187
Optional< std::string > name
Definition: schema2.h:97
vector< vector< string > > data
Definition: schema1.h:190
Optional< std::vector< std::vector< std::string > > > data
Definition: schema2.h:111
string name
Definition: schema1.h:189
Here is the call graph for this function:

◆ Item() [6/8]

schema2::Item::Item ( const schema1::Plot it)
inline

Definition at line 140 of file schema2.h.

References schema1::Plot::legend, schema1::Plot::logx, schema1::Plot::logy, schema1::Plot::ports, schema1::Plot::xlabel, schema1::Plot::y1label, and schema1::Plot::ylabel.

140  :
141  ItemBase(it, "PlotWidget"), name(it.title)
142  {
143  logx=it.logx;
144  logy=it.logy;
145  xlabel=it.xlabel;
146  ylabel=it.ylabel;
147  y1label=it.y1label;
148  if (it.legend) legend=*it.legend;
149  ports=it.ports;
150  }
vector< int > ports
Definition: schema1.h:153
Optional< ecolab::Plot::Side > legend
Definition: plotOptions.h:57
shared_ptr< Side > legend
Definition: schema1.h:154
string title
Definition: schema1.h:156
string xlabel
Definition: schema1.h:156
Optional< std::string > xlabel
Definition: plotOptions.h:52
string ylabel
Definition: schema1.h:156
Optional< bool > logx
Definition: plotOptions.h:50
string y1label
Definition: schema1.h:156
std::vector< int > ports
Definition: schema2.h:75
Optional< std::string > y1label
Definition: plotOptions.h:52
Optional< std::string > name
Definition: schema2.h:97
Optional< std::string > ylabel
Definition: plotOptions.h:52
Optional< bool > logy
Definition: plotOptions.h:50

◆ Item() [7/8]

schema2::Item::Item ( const schema1::Group it)
inline

Definition at line 151 of file schema2.h.

151 : ItemBase(it,"Group"), name(it.name) {}
Optional< std::string > name
Definition: schema2.h:97
string name
Definition: schema1.h:170

◆ Item() [8/8]

schema2::Item::Item ( const schema1::Switch it)
inline

Definition at line 152 of file schema2.h.

References schema1::Switch::ports.

152 : ItemBase(it,"SwitchIcon") {ports=it.ports;}
std::vector< int > ports
Definition: schema2.h:75
vector< int > ports
Definition: schema1.h:181

Member Function Documentation

◆ addLayout()

void schema2::Item::addLayout ( const schema1::UnionLayout layout)
inline

Definition at line 154 of file schema2.h.

References schema1::SizeLayout::height, schema1::ItemLayout::rotation, schema1::SliderLayout::sliderBoundsSet, schema1::SliderLayout::sliderMax, schema1::SliderLayout::sliderMin, schema1::SliderLayout::sliderStep, schema1::SliderLayout::sliderStepRel, schema1::SliderLayout::sliderVisible, schema1::SizeLayout::width, schema1::PositionLayout::x, and schema1::PositionLayout::y.

154  {
155  x=layout.x;
156  y=layout.y;
157  rotation=layout.rotation;
158  if (layout.width>=0)
159  width.reset(new float(layout.width));
160  else if (type=="PlotWidget")
161  width.reset(new float(150));
162  if (layout.height>=0)
163  height.reset(new float(layout.height));
164  else if (type=="PlotWidget")
165  height.reset(new float(150));
166  if (layout.sliderBoundsSet)
167  slider.reset(new Slider(layout.sliderVisible,layout.sliderStepRel,
168  layout.sliderMin,layout.sliderMax,layout.sliderStep));
169  }
float y
position in canvas, or within group
Definition: schema2.h:72
Optional< Slider > slider
Definition: schema2.h:100
std::string type
Definition: schema2.h:71
Optional< float > height
Definition: schema2.h:96
double rotation
rotation of icon, in degrees
Definition: schema2.h:74
Optional< float > width
Definition: schema2.h:96

Member Data Documentation

◆ arg

Optional<double> schema2::Item::arg

Definition at line 109 of file schema2.h.

◆ assetClasses

Optional<std::vector<minsky::GodleyAssetClass::AssetClass> > schema2::Item::assetClasses

Definition at line 112 of file schema2.h.

Referenced by Item().

◆ axis

Optional<std::string> schema2::Item::axis

Definition at line 108 of file schema2.h.

◆ bookmarks

Optional<std::vector<minsky::Bookmark> > schema2::Item::bookmarks

Definition at line 115 of file schema2.h.

◆ data

Optional<std::vector<std::vector<std::string> > > schema2::Item::data

Definition at line 111 of file schema2.h.

Referenced by Item().

◆ dataOpData

Optional<std::map<double,double> > schema2::Item::dataOpData

Definition at line 102 of file schema2.h.

◆ dimensions

Optional<minsky::Dimensions> schema2::Item::dimensions

Definition at line 106 of file schema2.h.

◆ filename

Optional<std::string> schema2::Item::filename

Definition at line 103 of file schema2.h.

◆ height

Optional<float> schema2::Item::height

Definition at line 96 of file schema2.h.

◆ iconScale

Optional<float> schema2::Item::iconScale

Definition at line 113 of file schema2.h.

◆ init

Optional<std::string> schema2::Item::init

Definition at line 98 of file schema2.h.

◆ intVar

Optional<int> schema2::Item::intVar

Definition at line 101 of file schema2.h.

◆ lockGroup

Optional<int> schema2::Item::lockGroup

Definition at line 105 of file schema2.h.

◆ name

Optional<std::string> schema2::Item::name

Definition at line 97 of file schema2.h.

Referenced by schema3::Item::Item().

◆ palette

Optional<std::vector<ecolab::Plot::LineStyle> > schema2::Item::palette

Definition at line 117 of file schema2.h.

◆ ravelState

Optional<RavelState> schema2::Item::ravelState

Definition at line 104 of file schema2.h.

◆ slider

Optional<Slider> schema2::Item::slider

Definition at line 100 of file schema2.h.

◆ tensorData

Optional<classdesc::CDATA> schema2::Item::tensorData

Definition at line 116 of file schema2.h.

◆ units

Optional<std::string> schema2::Item::units

Definition at line 99 of file schema2.h.

◆ width

Optional<float> schema2::Item::width

Definition at line 96 of file schema2.h.


The documentation for this struct was generated from the following files: