I'm trying to format a media use the IVdsVolumeMF2::FormatEx.
How do I get an object that has this interface implemented?
Related
Is there a way to explicitly serialize a Slice object to a string using ice? The problem is that there is an object which must be sendable by json / xml / ice and since ice already has a platform independent object in the Specification Language for Ice(Slice), there is no need to include another library like protobuf. But as far as I can see, it is not possible to serialize the object explicitly. Am I wrong?
You can serialize the object in the Ice binary format using the OutputStream API
Ice::ByteSeq inParams, outParams;
Ice::OutputStream out(communicator);
out.startEncapsulation();
Demo::CPtr c = new Demo::C;
c->s.name = "blue";
c->s.value = Demo::blue;
out.write(c);
out.writePendingValues();
out.endEncapsulation();
out.finished(inParams);
There is additional examples in ice-demos repository https://github.com/zeroc-ice/ice-demos/tree/3.7/cpp98/Ice/invoke
The docs for OutputStream can be found at https://doc.zeroc.com/ice/3.7/client-server-features/dynamic-ice/streaming-interfaces/c++-streaming-interfaces/the-outputstream-interface-in-c++
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.
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”
HttpRequest* request = new HttpRequest();
request->setUrl("http://just-make-this-request-failed.com");
request->setRequestType(HttpRequest::Type::GET);
request->setResponseCallback(this, httpresponse_selector(HttpClientTest::onHttpRequestCompleted));
This code is from the NetworkTest of cocos2d-x 3.0. I don't understand why I should pass Layer* to setResponseCallback? What if I want to send/get request/response without creating a single layer? Why shouldn't I be able to do that?
Selector in obj-c is just the name of the method so in order to call it you need a reference to the object as well. The code calls it "httpresponse_selector" and cocos2d-x is reportedly modelled after obj-c so might be it.
I want to create a new EObject, but by default the constructor is protected.
Is there a way to overcome that and create a new instance of EObject?
EMF uses the factory pattern. Please try EcoreFactory.eInstance.createEObject().
If you want to instantiate other objects that implement EObject, you'll have to use the respective factory for your own EPackage. The code should read MyPackFactory.eInstance.createObject() where MyPackFactory should be replaced by your concrete factory and createObject() has to be replaced by the type that you want to instantiate, e.g. createObjectValue()