Jamba C++ API  5.1.1
StateAware.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 pongasoft
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy of
6  * the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations under
14  * the License.
15  *
16  * @author Yan Pujante
17  */
18 #pragma once
19 
21 
23 
29 template<typename TGUIState>
31 {
32  static_assert(std::is_convertible_v<TGUIState *, GUIState *>);
33 
34 public:
41  virtual void initState(GUIState *iGUIState)
42  {
43  // because of the static assert, we know that this will not return nullptr
44  fState = dynamic_cast<TGUIState *>(iGUIState);
45  DCHECK_F(fState != nullptr); // sanity check
46  fParams = &fState->fParams;
47  }
48 
49 public:
52  TGUIState *fState{};
53 
56  typename TGUIState::PluginParameters const *fParams{};
57 };
58 
59 }
This class is used to get access to the GUI state and parameters of the plugin with their actual type...
Definition: StateAware.h:30
Definition: GUIState.h:41
TGUIState::PluginParameters const * fParams
Gives direct access to parameters (ex: fParams->fBypassParam)
Definition: StateAware.h:56
TGUIState * fState
Gives access to the GUI state (ex: fState->fLabelA)
Definition: StateAware.h:52
virtual void initState(GUIState *iGUIState)
This method is called by Jamba automatically to initialize the state.
Definition: StateAware.h:41
Definition: CustomController.h:24