What type is a points vector in objective C - vector

I have the following declaration for a function and I don't know what I am doing wrong with regards to the type declaration:
//function is defined in the OpenCVWrapper.mm file .....no errors
+ (NSArray *)analysePoints:(std::vector<cv::Point> )pointsVector{
.......
}
//error is in the OpenCVWrapper.h file
#interface OpenCVWrapper : NSObject
+ (NSArray *)analysePoints:(NSMutableArray *)mutableArray:(std::vector<cv::Point>)pointsArray;
//red marker under the std
#end
I am getting the error "expecting type" for the vector. What am I doing wrong here?

Actually, I found the solution through user11118321 input to look at the bigger picture. I am using this set up in a swift app that uses openCV through a bridging header. It is actually not possible to import or use a vector in swift.

Related

Key binding by file type

Description
I'm trying to create a key binding that behaves differently based on the file type.
Ideally what id like to do is the following:
If the file type is .md then run the command markdown-preview-plus:toggle
else run the command script:run
I know it's something along the lines of:
file init.coffee :
editor.command('custom:command', e => {
if ( of file type .md) {
markdown-preview-plus:toggle
} else {
script:run
}
})
Then in the keymap.cson i have to add something like:
'atom-text-editor':
'cmd-i': 'custom:command'
But obviously this is pseudocode. I've tried reading the documentation specifically this
but there isn't enough information.
I was able to do this by adding the following to the keymap.cson file:
"atom-text-editor[data-grammar='source gfm']":
'cmd-i': 'markdown-preview-plus:toggle'
"atom-text-editor:not([data-grammar='source gfm'])":
'cmd-i': 'script:run'
For anyone trying to do something similar to this, I used this as reference:
Atom grammer syntax

Sending vector data in the bus

I have a vector data (an array variable for example float32 mydata[5];). for transmitting a single primitve/basic data in a bus its pretty simple.
inside_data=Simulink.BusElement;
inside_data.Name='somename';
inside_data.SampleTime = -1;
inside_data.datatype='single';
this element can be put inside a using
Bus=Simulink.Bus;
Bus.Elements=inside_data;
But this works when the input is a primitive. But what if my data is a vector. like float32 a[5]; then how can i send this data element in a bus.
UPDATE
So I tried to use a constant block named a with datatype single in which the input part i changed it as [1 2 3] which is a vector input.
another element is b with uint8 datatype.
i used the s-function builder just to check the working of this model. i already set everything (bus_mode on , datatype to be bus type etc). in the output part i used something like:
y0[0]=u0->a[0];
y0[1]=u0->a[1];
y0[2]=u0->a[2];
y1[0]=u0->b;
But it throws error as
c:\program files (x86)\matlab_v7111_r10bsp1\extern\include\matrix.h(313) : error C2061: syntax error : identifier 'mxLogical'
c:\program files (x86)\matlab_v7111_r10bsp1\extern\include\matrix.h(313) : error C2059: syntax error : ';'
my final aim is to use it for s_function
so if i declare a variable in s_func as
real32_T *a_output[5]=(real32_T *)ssGetOutputPortRealSignal(S,0);
and then i have a strcuture(because am transmitting data with a bus so the bus header file has this structure) and how do i declare and assign the input to the output.
a_output[0]=my_struct->a_input[0];
a_output[1]=my_struct->a_input[1];
a_output[2]=my_struct->a_input[2];
a_output[3]=my_struct->a_input[3];
a_output[4]=my_struct->a_input[4];
but the problem is with the declaration. it gives me error cannot convert from real32_T to real32_T * .
The main idea is to create Bus of type you need.
I did it this way:
num = zeros(15,15,15);
move = zeros(15,15,15);
a = struct('number',num,'movement', move);
busInfo = Simulink.Bus.createObject(a);
You can see it's possible to create any data structure, array, vector anything you want and then create Bus Signal of the same type.
I use this in callbacks/preLoadFcn (Model Explorer) to define this type in workspace, it creates slBus1 variable (its Bus Signal of my type), so I need to define output (or input if necessary) of any block like slBus1 only. And then use Bus Selector to work array data.
Can it helps to you?
ADD NEW INFORMATION
It depends of what you want.
For example: I create s-function for feedback system. It use my structure like this:
function a = fcn(BusSignal)
%#codegen
num = zeros(15,15,15);
move = zeros(15,15,15);
%...some math actions with num and move...
a = struct('number',num,'movement', move);
%...and some action with a structure... for example:
if (c>b)
a.number(1,2,3) = 15;
a.movement(1,2,3) = 42;
else
a = BusSignal;
end
Look at this - I use Bus signal at entrance and at exit and use Bus Selector to work it's data with.
REMEMBER to define input and output data as Bus Signals!

BirdWatching app 'incompatible pointer types initializing'

I just started coding and as I followed Apple's article 'Your Second iOS App:Storyboard', I had a warning that says 'incompatible pointer types initializing Birdsighting *__strong with an expression of type NSString *' from the following code:
detailViewController.sighting = [self.dataController objectInListAtIndex:[self.tableView indexPathForSelectedRow].row];
well you are trying to say (IT SEEMS):
NSString *stringInCurrentTableViewRow = [self.dataController objectInListAtIndex:[self.tableView indexPathForSelectedRow].row];
BirdSighting *yourObject = stringInCurrentTableViewRow;
you are sure the dataController doesnt contain Strings ;)

UDK "Error, Unrecognized member 'OpenMenu' in class 'GameUISceneClient'"

Upon compiling, I am getting the following error:
C:\UDK\UDK-2010-03\Development\Src\FixIt\Classes\ZInteraction.uc(41) : Error, Unrecognized member 'OpenMenu' in class 'GameUISceneClient'
Line 41 is the following:
GetSceneClient().OpenMenu("ZInterface.ZNLGWindow");
But when I search for OpenMenu, I find that it is indeed defined in GameUISceneClient.uc of the UDK:
Line 1507: exec function OpenMenu( string MenuPath, optional int PlayerIndex=INDEX_NONE )
It looks like I have everything correct. So what's wrong? Why can't it find the OpenMenu function?
From the wiki page on Legacy:Exec Function:
Exec Functions are functions that a player or user can execute by typing its name in the console. Basically, they provide a way to define new console commands in UnrealScript code.
Okay, so OpenMenu has been converted to a console command. Great. But still, how do I execute it in code? The page doesn't say!
More searching revealed this odd documentation page, which contains the answer:
Now then, there is also a function
within class Console called 'bool
ConsoleCommand(coerce string s)'. to
call your exec'd function,
'myFunction' from code, you type:
* bool isFunctionThere; //optional
isFunctionThere = ConsoleCommand("myFunction myArgument");
So, I replaced my line with the following:
GetSceneClient().ConsoleCommand("OpenMenu ZInterface.ZNLGWindow");
Now this causes another error which I covered in my other question+answer a few minutes ago. But that's it!
Not sure if this is your intent, but if you are trying to create a UIScene based on an Archetype that has been created in the UI Editor, you want to do something like this:
UIScene openedScene;
UIScene mySceneArchetype;
mySceneArchetype = UIScene'Package.Scene';
GameSceneClient = class'UIRoot'.static.GetSceneClient();
//Open the Scene
if( GameSceneClient != none && MySceneArchetype != none )
{
GameSceneClient.OpenScene(mySceneArchetype,LocalPlayer(PlayerOwner.Player), openedScene);
}

UDK "Error, 'DefaultMesh': Bad command or expression"

I'm porting UT3 code to UDK, and I am getting the following compile error with the UDK compiler:
C:\UDK\UDK-2010-03\Development\Src\FixIt\Classes\ZPawn.uc(25) : Error, 'DefaultMesh': Bad command or expression
The ZPawn class extends UTPawn.
Line 25 is the following:
DefaultMesh = SkeletalMesh(DynamicLoadObject(ZBotOwner(Owner).MeshToUse, class'SkeletalMesh'));
Where did DefaultMesh go in UDK?
The SkeletalMesh is part of the Mesh Component in a Pawn:
Begin Object Class=SkeletalMeshComponent name=Mesh01
SkeletalMesh=SkeletalMesh'pawnPackage.Meshes.mySkeletalMesh'
AnimTreeTemplate=AnimTree'pawnPackage.Anims.myAnimTree'
PhysicsAsset=PhysicsAsset'pawnPackage.Physics.myPhysicsAsset'
AnimSets(0) =AnimSet'pawnPackage.Anims.myAnimSet'
End Object
Mesh=Mesh01
Components.Add(Mesh01)
Well just to be clear, the line change you will want will be this:
Mesh = SkeletalMesh(DynamicLoadObject(ZBotOwner(Owner).MeshToUse, class'SkeletalMesh'));
Assuming of course your ZBot is all set up correctly.
Also I'm assumign that this is in default properties? Don't forget to add it to your components
Components.Add(Mesh);

Resources