Jamba C++ API 7.5.0
Loading...
Searching...
No Matches
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 or the MIT license,
5 * at your option. You may not use this file except in compliance with
6 * one of these licenses. You may obtain copies of the licenses at:
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 * https://opensource.org/licenses/MIT
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 *
17 * @author Yan Pujante
18 */
19
20#pragma once
21
22#include "GUIVstParameter.h"
23
25
26//------------------------------------------------------------------------
27// IGUIParameter::cast
28//------------------------------------------------------------------------
29template<typename T>
30std::shared_ptr<ITGUIParameter<T>> IGUIParameter::cast()
31{
32 auto sft = shared_from_this();
33
34 auto rawPtr = std::dynamic_pointer_cast<GUIRawVstParameter>(sft);
35
36 if(rawPtr)
37 {
38 auto vstPtr = rawPtr->asVstParameter<T>();
39 if(vstPtr)
40 return vstPtr;
41 }
42
43 return std::dynamic_pointer_cast<ITGUIParameter<T>>(sft);
44}
45
46}
std::shared_ptr< ITGUIParameter< T > > cast()
Downcasts this parameter into a typed version.
Definition IGUIParameter.hpp:30
Definition GUIState.h:38