Accessing members of an object - c++

I'm using the JUCE framework and I currently have access to an object and I need to access some text which belongs to this object. When I'm watching I can see the text that I want
But when I try access it directly with sound.name.text or using the sound.getName() (which belongs to the SamplerSound class) I get the output class “juce::SynthesiserSound” has no member “name”

Related

Is it possible to inject a component that doesn't have a prefab/GameObject associated with it?

I have a game object (a cube, let's say) which exists in the scene, and I want it to have an injectable component. I want to be able to say, for example: My cube has an IShotFirer member, which can resolve to either a BoomShotFirer or a BangShotFirer MonoBehavior component, both of which implement IShotFirer. When binding happens, I want this component to be added to the cube object.
public class CubeBehavior : MonoBehaviour
{
[Inject]
private IShotFirer shotFirer;
}
Is it possible to do this without 1) needing an existing prefab which contains one of these Bang/Boom components, or 2) needing an existing scene object which has one of these components attached?
In other words, I want to be able to dynamically add the component to my game object depending on the bindings, and not relying on anything other than the script files which define either BoomShotFirer or BangShotFirer. But the docs seem to imply that I need to find an existing game object or prefab (e.g. using .FromComponentsInChildren(), etc.)
Is it possible to do this without 1) needing an existing prefab which
contains one of these Bang/Boom components, or 2) needing an existing
scene object which has one of these components attached?
Yes, it is.
Zenject provides a host of helpers that create a new components and bind them -- quoting the docs:
FromNewComponentOnRoot - Instantiate the given component on the root of the current context. This is most often used with GameObjectContext.
Container.BindInterfacesTo<BoomShotFirer>().FromNewComponentOnRoot();
FromNewComponentOn - Instantiate a new component of the given type on the given game object
Container.BindInterfacesTo<BoomShotFirer>().FromNewComponentOn(someGameObject);
FromNewComponentOnNewGameObject - Create a new game object at the root of the scene and add the Foo MonoBehaviour to it
Container.BindInterfacesTo<BoomShotFirer>().FromNewComponentOnNewGameObject();
For bindings like this one that create new game objects, there are also extra bind methods you can chain:
WithGameObjectName = The name to give the new Game Object associated with this binding.
UnderTransformGroup(string) = The name of the transform group to place the new game object under.
UnderTransform(Transform) = The actual transform to place the new game object under.
UnderTransform(Method) = A method to provide the transform to use.
That list is not even exhaustive, be sure to check the readme and the cheatsheet (from both of which I have extracted the info above).
Also understand that, as usual, you can append .AsSingle(), .AsTransient() and .AsCached() to achieve the desired result.

Tensorflow Modify OpKernelConstruction Attributes

In kernel operations, an OpKernelConstruction pointer is given to the OpKernel constructor, for example
I would like to change some attributes in the context before passing it to the parent constructor.
For example, something like
explicit StreamQueueOp(OpKernelConstruction* context) :
TypedQueueOp(private_modifying_method(context))
But it appears in the description of OpKernelConstruction, that no modifying method exists. Is there a way to modify it?
EDIT:
I want to modify the attributes because I am attempting to make a FIFOQueue that pulls data from a database. I only want the user to have to specify the data stream id and then the queue would hit the database for the shape and type of the data. As such, I want to modify the context to add the shape and type info after I get it from the DB, but before I pass the context onto the base class. The base class makes use of shape and type, so I need to make sure it is in correspondence with the DB.

Firemonkey: How to iterate through all forms in the application using TScreen.Forms

I am attempting to iterate through the forms I have open in my application. I have found the documentation for FMX.Forms.TScreen.Forms, which looks like it can be used to accomplish my goal. However, I am confused on how I am supposed to use it.
At first I tried this in a function within my form's CPP file:
ShowMessage( Forms::TScreen::FormCount );
This produced the error 'Member TScreen::FormCount cannot be used without an object'
I figured that to mean that I need to attempt to access this property from my form, or from the global Application variable. I tried both
this->Forms...
Application->Forms...
and
this->TScreen...
Application->TScreen...
However, neither Forms nor TScreen exist within either of these objects.
How do I go about accessing Forms.TScreen.Forms?
The error gives you a clue:
Member TScreen::FormCount cannot be used without an object
TScreen is a class, not an object. FormCount is not a static member of the class, so you need an object instance of the TScreen class. And such an object is provided for you - the global Screen object:
ShowMessage( Screen->FormCount );
This is stated in the documentation:
FMX.Forms.TScreen
There is a global variable, Screen, of type TScreen, which is instantiated for use by any application with a GUI. Use Screen to obtain information about the current state of the screen in an application.
FMX.Forms.Screen
extern DELPHI_PACKAGE TScreen* Screen;
Here's what works well:
ShowMessage(Screen->FormCount);
Screen is a global object, like Application. The compiler said that FormCount is not static method or smth.

what is a Builder return type in Blackberry10 Cascades

The following is an API reference for a method in "QmlDocument" class(Blackberry10).
Builder create (const QString &qmlAsset, boolautoLoad )
Creates and returns a builder for constructing a QmlDocument instance
with a parent object and an asset name to load the document from.
Parameters qmlAsset The QML asset name load the document from,
specified relative to the assets root. autoLoad if true the document
is automatic loaded, otherwise it is required to call load function
explicitly. The default is true . Since: BlackBerry 10.0.0
Now what is exactly meant by a "Builder" here. What is its purpose? what is the difference of creating an object from QmlDocument class with "new" keyword, and creating the object with the method defined above?
Builders are usually classes defined locally to the associated class (ie QmlDocument::Builder) that allow chaning of methods with operator . () in a way similar to that done with iostreams and operator << (). What it gets you is a more readable way of createing objects (and potentially their childre) in one statment rather than creating with a new operator and a number of function calls. A better example than QmlDocument might be the Container class:
Container *container1 = Container::create()
.preferredSize(200, 200)
.background(Color::Blue);
This creates a new Container, sets the preferred size and background color. The implementations details are hidden. Somewhat simmilar to an opaque type in C.

How to instantiate an object with IVdsVolumeMF2 interface?

I'm trying to format a media use the IVdsVolumeMF2::FormatEx.
How do I get an object that has this interface implemented?