Jamba C++ API  4.5.0
IGUIParameter.hpp
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 
19 #pragma once
20 
21 #include "GUIVstParameter.h"
22 
24 
25 //------------------------------------------------------------------------
26 // IGUIParameter::cast
27 //------------------------------------------------------------------------
28 template<typename T>
29 std::shared_ptr<ITGUIParameter<T>> IGUIParameter::cast()
30 {
31  auto sft = shared_from_this();
32 
33  auto rawPtr = std::dynamic_pointer_cast<GUIRawVstParameter>(sft);
34 
35  if(rawPtr)
36  {
37  auto vstPtr = rawPtr->asVstParameter<T>();
38  if(vstPtr)
39  return vstPtr;
40  }
41 
42  return std::dynamic_pointer_cast<ITGUIParameter<T>>(sft);
43 }
44 
45 }
Represents a gui parameter with its underlying backing type T (aka ParamType).
Definition: IGUIParameter.h:33
Definition: GUIState.h:37
std::shared_ptr< ITGUIParameter< T > > cast()
Downcasts this parameter into a typed version.
Definition: IGUIParameter.hpp:29