Queue in object-oriented programming

Hello

I'm currently building multiple classes for the different data acquisition devices. What they all have in common, is that they use a 3D array of integer in the data buffer. I want to be able to switch between devices, so I decided to create a VI called "Record.vi" and the use of dynamic allocation to decide what device to call at run time.

But I don't want a buffer to separate data for each device, so I will try to figure out how to create a more "global" space to save my data. Now, I decided to use a queue for this (as I don't want to LabVIEW to make copies of my table 3D all the time). My question is now how the queues are really handled in object-oriented programming, because in non-object oriented programming, if I create a queue and name it, say, 'data' and create the queue even elsewhere (again with the ' data' as name), I have access to the first queue created and do not get a new one. If I create now, for my problem, a class parent where all devices data inherit from and make a member variable "queue in 3d-table", what will happen? All the data devices that inherit from this class calls the same queue? Or it is duplicated? What is the best way to use common storage place in all the data devices? A global variable in the parent (that is, a static variable) class? Or should I create a 'normal', accessible global variable of all the screws?

Thanks for the help!

Christian

If you do not want the child to use the buffer of parents can create an override for the child who creates his own stamp.

Named queues the override VI could use its name in the name of the queue.

For non designated queues, just pass the reference.

Notes:

DVR (data value reference) is also another way to share a buffer.

3-d arrays:

Unless all dimensions of thre sense I generally avoid them because they rate of N cut into cubes where "N" is the largest of its very small size (or something like that) so just a slice of the buffer bigger (because of processing delays) the blow (voice of experience speaking).

Ben

Tags: NI Software

Similar Questions

  • 'Normal' code and OBJECT-oriented programming code in the same project

    Hi guys,.

    Have large existing application written in ordinary data workflow code.

    Thought to add a new module, but he wrote in OOP - to learn.

    Is it possible to add OBJECT-oriented programming code to an existing project?  If so, it's a good idea or not?  What kinds of things should I be conscious re. mix of types of codes?

    Thank you.

    LVOOP is a natural extension of type-def clusters in libraries, so he has no problem mixing with 'normal' LabVIEW code  The only precaution that I recommend is the following:

    Class libraries always loading all their confined subVIs (called "methods" in the jargon of OBJECT-oriented programming), and the standard libraries of LVLIB always loading libraries contained everything (including class libraries).  This behavior "one thing costs so everthing charge" may be a domino effect through your project with all sorts of unnecessary things from loading.  To avoid this, be careful putting classes inside libraries and don't always put subVIs in classes if they do not need to be (I often have a regular library to hold 'to support' subVIs to a set of classes.)

    -James

  • I'm still not sure how custom control and object-oriented programming interact, can someone enlighten me please?

    I spent some time trying to understand the relationship between the custom controls and object oriented programming. However, it is not quite clear to me yet.

    What I want to do:

    I want to have a custom control and hide its workings from the rest of the blockdiagram, so I don't have to wire for each similar object. Not only because I'm lazy , but also to keep the clean pattern and avoid mistakes.

    for example, a graph, a numerical factor and a button.

    When the button is pressed, the x scale must be changed according to the factor.

    So, this looks like a job for me to object-oriented programming. Once I created something that can do this, I can use it all through my program. The code that redraws the figure when you press the button as part of the object, so I can't connect extra wires and add a value change event when I add a new chart.

    Is this possible at all? I tried, but did not quite understand this time. I have to admit that I'm pretty new to OO programming and make custom controls. I use typedef clusters ' ed most my code so far, which works very well. But it's always a cluster of stupid, the only way to have nothing at all is in the block diagram in VI you use it in.

    The only thing I could come up with so far is to add an "event handler" Subvi who does and that he accepts a reference or a local variable to an object. Then, this sub - VI and the variable or reference can be put in parallel with the other stuff in the main loop of the program. But there must be a better way somewhere?

    I don't think I can solve this problem of definition of the objects of the Panel before custom and methods so that it can interact with the objects that it represents without help. I get the feeling that I must have missed it somewhere. The pointers will be appreciated.

    Thank you!

    Jacco.

    Jacco K wrote:

    What I want to do:

    I want to have a custom control and hide its workings from the rest of the blockdiagram, so I don't have to wire for each similar object. Not only because I'm lazy , but also to keep the clean pattern and avoid mistakes.

    ...

    The only thing I could come up with so far is to add an "event handler" Subvi who does and that he accepts a reference or a local variable to an object. Then, this sub - VI and the variable or reference can be put in parallel with the other stuff in the main loop of the program. But there must be a better way somewhere?

    Thank you!

    Jacco.

    Hi Jacco,

    These two things are exactly what are the Xcontrols, a basic VI with a façade that has an event structure (the façade VI).

    If you have any questions, I'm happy to guide you.

    Tone

  • Navigation in AS3 OBJECT oriented programming Menu does not

    OK, so frame 1 in the timeline/layer, I have this code

    Stop();

    var btn1:MCButton = new MCButton();

    Btn1.x = 1048;

    Btn1.y = 300;

    Btn1.label_txt. Text = "play";

    addChild (btn1);

    Btn1.gotoAndStop (10);

    var btn2:MCButton = new MCButton();

    btn2.x = 1048;

    btn2.y = 380;

    btn2.label_txt. Text = "help";

    addChild (btn2);

    var btn3:MCButton = new MCButton();

    btn3.x = 1048;

    btn3.y = 460;

    btn3.label_txt. Text = "highscore";

    addChild (btn3);

    and now I have a MCButton class (.as)

    package {}

    import flash.display.MovieClip;

    import flash.events.MouseEvent;

    SerializableAttribute public class extends MovieClip {} MCButton

    public void MCButton() {}

    manufacturer code #.

    Stop();

    this.buttonMode = true; a class film btn

    this.addEventListener (MouseEvent.MOUSE_OVER, sensitive); listen for a score event mouse

    this.addEventListener (MouseEvent.MOUSE_DOWN, down); listen for a mouse down event

    }

    private void hover(e:MouseEvent):void {}

    this.removeEventListener (MouseEvent.MOUSE_OVER, sensitive);

    this.addEventListener (MouseEvent.MOUSE_OUT, out);

    this.gotoAndStop (2);

    }

    private void out(e:MouseEvent):void {}

    this.removeEventListener (MouseEvent.MOUSE_OUT, out);

    this.addEventListener (MouseEvent.MOUSE_OVER, sensitive);

    this.gotoAndStop (1);

    }

    private void down(e:MouseEvent):void {}

    this.removeEventListener (MouseEvent.MOUSE_OVER, sensitive);

    this.addEventListener (MouseEvent.MOUSE_DOWN, down);

    this.gotoAndStop (3);

    }

    }

    }

    OK so I want btn1 (which is in my diapers) to frame 10, where I have a different menu for 'easy', 'medium' "hard", I put btn1.gotoAndStop (10); but that doesn't seem to work, so I'm really confused on what im doing wrong.

    Please help me,

    Thank you.

    You can not remove sth. not created:

    removeChild (btn6);

    ...

    var btn6:MCButton = new MCButton();


    you try to remove btn6-9, before they were created

    I understand why you want to do, but you must make sure that the part to be removed is left side first.

    You can do this by ensuring that the button you are trying to delete is really there

    Change each line that removes sth. TO:

    {if(btn6!=null)}

    removeChild (btn6);

    }

    {if(btn7!=null)}

    removeChild (btn7);

    }

    etc.

    Caution:

    Trying to set up a Navigation like this can not be considered good practice to OBJECT-oriented programming.

    That's why I said you should be aiming for a solution that does not rely on navigation of the timeline.

  • OBJECT-oriented programming using global vars, best way to do it?

    LS,

    Im a beginner when it comes to OOP.

    Not wanting all through calls to the class, I want to be able to have some application globals.

    Can set their standard package?

    Should I create a static class globals.as with vars?

    What is the right way to do this?

    Any help is greatly appreciated.

    Mac

    first of all, I would say that there are few cases where, you would need global variables, I have not used any in a long time and at the moment, I can't imagine any situation where I would do it. Although saying that it may be the easiest solution if you are new to OBJECT oriented programming.

    If I had to I would use a static class with vars, as you say

  • (help) how to extend textbox of scene to the method of object-oriented programming

    Hi guys, just a simple question. I have a box of text inside the scene. I just want to know how will access using the methodology of object-oriented programming. Thank you for your help guys.

    Select the textfield and then assign it and the name of the instance in the properties panel. If you do not see an option for this in the properties panel, you must change this setting to be a dynamic textfield.  Once you have an instance name are entrusted to him, you use this name to target for what you want to do with it.  For example, if you call it 'tField', then to give him a text you would use...

    tField.text = "of the text."

  • A matter of OBJECT-oriented programming

    I am new to OBJECT oriented programming, this is probably a stupid question, but if I want to create an app that involves students it is necessary to create a class of studen in as3.0? If so, it is also necessary to call this class when I'm querying data from my db?

    Thank you.

    Well, more like a question of application of an OO one design!

    in any case you do not have to! But it is certainly a good idea to have an object representation of your business domain artifacts.

  • LabVIEW Object - Oriented Programming - tutorial

    Hello

    Are there tutorial manual LVOOP? I'm looking for a tutorial as LabVIEW Basics I and II, which explains the basics

    If you have any SSP you have access to a range of online courses , including the object-oriented design and programming in LabVIEW (the recommendation is to have taken 1 Core, Core 2 and Core 3 before taking this course to get the most benefits).

    If you come from of the object oriented and want to see how it applies to LabVIEW, take a look at the decisions behind the white paper Design.

    Hope that helps,

    Jeff Peacock

    Product Support Engineer | LabVIEW R & D | National Instruments | Certified LabVIEW Architect

  • Object oriented programming

    I'm unable to transfer data from one point of view to another using objects.

    I have 2 views named FirstView.mxml and SecondView.mxml.

    I have 1 actionscript file named Pass.as

    Any help is very appreciated.

    Pass.As

    package components

    {

    public class Pass

    {

    [Bindable]

    public var first: String;

    public var second: String;

    public void Pass()

    {

    }

    public void setFirst(first:String):void

    {

    This.First = first;

    }

    public void setSecond(second:String):void

    {

    This.second = second;

    }

    public function getFirst (): String

    {

    back in the first place;

    }

    public function getSecond (): String

    {

    back then;

    }

    public void count with all (): String

    {

    first of all return + "" + second;

    }

    }

    }

    FirstView.mxml

    <? XML version = "1.0" encoding = "utf-8"? >

    " < = xmlns:fx s:View ' http://ns.Adobe.com/MXML/2009 "

    xmlns:s = "library://ns.adobe.com/flex/spark".

    title = 'FirstView.

    xmlns:components = "components.*" >

    < fx:Script >

    <! [CDATA]

    import components. Pass;

    [Bindable]

    public var pass: Pass;

    protected function handleClick(event:MouseEvent):void

    {

    pass = new Pass();

    pass.setSecond (inputbox2.text);

    pass.setFirst (inputbox1.text);

    navigator.pushView (SecondView);

    }

    []] >

    < / fx:Script >

    < fx:Declarations >

    <! - Place non-visual elements (e.g., services, items of value) here - >

    < / fx:Declarations >

    < s:Label text = "enter your identification number" x = "10" y = "10" >

    < / s:Label >

    < s:TextInput id = "inputbox1" x = "10" y = "33" >

    < / s:TextInput >

    < s:TextInput id = "inputbox2" x = "10" y = "145" >

    < / s:TextInput >

    < s:Button label = "Search" click = "handleClick (event)" x = "10" y = "362" > "

    < / s:Button >

    < / s:View >

    SecondView.mxml

    <? XML version = "1.0" encoding = "utf-8"? >

    " < = xmlns:fx s:View ' http://ns.Adobe.com/MXML/2009 "

    xmlns:s = "library://ns.adobe.com/flex/spark".

    title = "SecondView".

    xmlns:components = "components.*" >

    < fx:Script >

    <! [CDATA]

    import components. Pass;

    [Bindable]

    public var passData:Pass = new Pass().

    protected function handleClick(event:MouseEvent):void

    {

    Label3.text = passData.getAll ();

    }

    []] >

    < / fx:Script >

    < fx:Declarations >

    <! - Place non-visual elements (e.g., services, items of value) here - >

    < / fx:Declarations >

    < s:Label text = "{passData.getFirst ()}" = '10' XY '45' = > "

    < / s:Label >

    < s:Label text = "{passData.getSecond ()}" = '10' XY '145' = > "

    < / s:Label >

    < s:Label id = "label3" x = "10" y = "245" >

    < / s:Label >

    < s:Button label = "Search" click = "handleClick (event)" x = "10" y = "362" > "

    < / s:Button >

    < / s:View >

    you have 2 instances of passage here.

    in FirstView instead of the call

    navigator.pushView (SecondView);

    call

    navigator.pushView (SecondView, col);

    in SecondView instead of creating a new instance of the Pass you can access past created in FirstView through the property Explorer data in Secondview

    for example

    SecondView.mxml

    http://ns.Adobe.com/MXML/2009.

    xmlns:s = "library://ns.adobe.com/flex/spark".

    title = "SecondView".

    xmlns:components = "components.*" >

    import components. Pass;

    [Bindable]

    protected function handleClick(event:MouseEvent):void

    {

    Label3.text = (data in the form of Pass) .getAll ();

    }

    ]]>

  • ColdFusion object oriented programming

    Hello
    For the moment, I have a contact management application I am building.
    a contact has a title (m./Mme/Mlle) and can have multiple addresses, multiple phone numbers.

    CFC, I cannot make multiple inheritance. I can extend to 1 component, then extend to the next in a kind of 'daisy chain', but this is not ideal, that if something changes in my application there are a lot of dependencies.

    I'm learning to use what is called the aggregation by Hal Helms but I think this concept is difficult to grasp.

    I think I'm supposed to do something like the following see attached code:

    It seems to work very well, I have a setTitle() method in the contact.cfc which creates the object of title.

    The problem is, whenever I refer to the setTitle() method since the contact.cfc can I error saying that the return type is not of type 'title '.

    I think that i've got is it's completely wrong, or I'm missing something.

    Can someone please?

    My e-mail address is here

    You have defined the type of your cfargument tag to be the title, but as we can see from your attached code the path to the CFC is components.contact.title you need to change the type to that.

  • Calendar in OBJECT oriented programming

    Hello

    I need to get the order in which things are in my first game right. Here's what I want to do.

    1. Player click on the 'play' button, the button goes, and timer starts. It is all works well
    2. Then I want a text box to animate for 60frames. It works very well
    3. Then ONLY I want as my next video clips start to play

    How to do the step 3 wait only 60 images? I have no idea how this code.

    Help, please

    Images of recommended

    I create a movieclip in flash cc and add a textfield (for example, tf) with a police yellow (to view "your word") and assign a class (for example, WordBox).  I would like to use something like:

    package {}

    import flash.display.MovieClip;

    import flash.text.TextField;

    import com.greensock.TweenLite;  //<-i like="" to="" use="" this="" for="">

    SerializableAttribute public class extends MovieClip {} WordBox

    public void WordBox(s:String) {}

    S = This.TF.text;

    this.tf.autoSize = "left";

    this.addEventListener (Event.ADDED_TO_STAGE, init);

    }

    private void init(e:Event):void {}

    This position and start its interpolation if that's what you want

    This.x=(stage.stageWidth-this.width)/2;

    This.y = 0;

    TweenLite.to(this,1,{y:stage.stageHeight-this.height});)

    }

    public void textF (): String {}

    Return this.tf.text;

    }

    }

    }

    I also create a movieclip in flash with a textfield cc (for example, tf) for your tiles and create a tiling class (for example, mosaic) that will handle the display of the tile, movement and click:

    package {}

    import...

    Tile/public class extends MovieClip {}

    public void cage (s:String) {}

    S = This.TF.text;

    this.addEventListener (Event.ADD_TO_STAGE, init);

    this.addEventListener (MouseEvent.MOUSE_DOWN, downF);

    }

    private void init(e:Event):void {}

    position and assign a sinusoidal vertical movement

    }

    private void downF(e:MouseEvent):void {}

    dispatchEvent (new Event ("tileclickE"));

    }

    public function textF (): String {}

    Return this.tf.text;

    }

    }

    }

    and then in your controller class, you can retrieve the text of WordBox, distributed in a table, and when a tileclickE event is detected, determine if it was correct or incorrect slab click Tile click and take appropriate action.

  • Problem with the classes and the basics of object oriented programming.

    I got a main class called 'controll class:

    I'm addChild a btn on stage and create a listener to click the btn.

    When you click on the function of animation the curretn clip on the stage and moves out and addChild an another movieclip

    Levels_BG called

    Levels_BG contains fixed and controlled but his class onwl: Levels_BG

    That creates a certain number of 'boxes' on the scene that can be clicked to select a level.

    I'm tryin to achieve this goal:

    Click on a level area in the Levels_BG and I need to pass this variable to another class.

    Any help appriciated. SRY if this is confussing.

    Pavel has soon

    SWF here:

    http://www.2shared.com/document/pO8IIf4x/NumberGame.html

    Able to operate found this great guide:

    http://StackOverflow.com/questions/11083843/AS3-call-function-from-one-class-to-another

    I changed my function in control_Class:

    public static function startlevel (): void

    {

    trace ("from this class to it")

    }

    control_Class.startlevel ();

    thx for the help.

    Pav

  • questions about OBJECT oriented programming

    good day to all, I am working on a class enemy now the idea I have is to give him an enemyUpdate method to make it move on its own using a while loop

    < code >

    public function updateEnemy (): void
    {
    var i: int = 0;
    While (i > 30)
    {
    This. PositionX = + 10;
    }
    }

    < code >

    OK so I understand his partly caused because I'm not increasing 'i' in my loop

    Now my problem is that I have the line of code above does not move correctly the enemy why so much?
    Thanks for the info

    If there is too much enemy opposes both on the scene, try this - in the enemy class add an event listener for the event enter frame:

    this.addEventListener (Event.ENTER_FRAME, updateEnemy);

    and update the position in the Manager.

    private void updateEnemy(e:Event):void

    {
    This.x += 5;
    }

    To decide if the enemy movement or not, you can use if statement in the updateEnemy function.

  • Problem of OBJECT-oriented programming.

    Hello friends,

    So, I'm learning to write classes to make my life easier in the long run... I'm that extends MovieClip and help Tweener inside my new class... Here's what I have:

    Import caurina.transitions.Tweener;


    @ author eric Shoemaker
    /////////////////////////////////////////////////////
    ////////////////////////////////////////////////////

    Mover class extends MovieClip {}

    public static var Instance: Mover;

    VARs:
    private var targetMC:MovieClip;
    private var xPos:Number;
    private var yPos:Number;

    manufacturer:
    function Mover() {}
    Instance = this;
    trace ("the constructor has been called");

    this.targetMC = targetMC;
    this.yPos = yPos;

    }

    function startMoving (targetMC:MovieClip, yPos:Number) {}
    Tweener.addTween (targetMC, {_y:yPos, time: 2});
    trace ("startMoving called");



    }

    }





    Now, in my FLA, I called you like:




    var myMover:Mover = new Mover();

    //
    Mover.startMoving (circle_mc, 400);



    I get this error:

    * Error * scene = scene 1, layer = as, frame = 1:Line 9: the referenced property does not have the static attribute.
    Mover.startMoving (circle_mc, 400);

    Total ActionScript errors: 1 reported errors: 1



    What does that mean?

    I had this job before, but only if I pass things to the constructor. That looked like:


    Import caurina.transitions.Tweener;


    @ author eric Shoemaker


    ////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////

    Mover class extends MovieClip {}

    public static var Instance: Mover;

    VARs:
    private var targetMC:MovieClip;
    private var xPos:Number;
    private var yPos:Number;

    manufacturer:
    function Mover (targetMC:MovieClip, yPos:Number) {}
    Instance = this;

    What we spend in the class? This part must be set!
    this.targetMC = targetMC;
    this.yPos = yPos;
    }

    private void updatePosition() {}
    Tweener.addTween (targetMC, {_y:yPos, time: 3});

    }


    public static void startMoving() {}
    Instance.updatePosition ();
    }

    }

    ////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////



    Can someone help me in the right direction? If you answer back, can you please your zip code so I can see where I made the mistake?

    Thank you very much!!!

    Thank you! Let me check it out. :)

  • Queues do not work in my object-oriented design

    I'm developing an application in real time, and I'm using an object-oriented approach. The design model is similar to the framework of the actor, but made to measure. The class structure is configured to support several different subsystems, with the highest class being a class 'subsystem '. Currently, I only have one motion in class just to check the legacy, but my problem is with the subsystem class.

    Each subsystem object has a few parameters, one of them being a "execution queue. This is a queue of strings 1 d arrays that dictates what to do on the next trigger subsystem. Each subsystem is started in a similar way as part of the actor (I used "Launch actor Core.vi" as a guide, so that means using an asynchronous call by reference (CGRA).) I simplified it for my purposes and also wound up the reference which the actor vi does not (I had problems even when left open reference), see image below.

    VI "SETUP", you see in the picture, is where the queue is initialized, I don't understand the code, because it is quite simple. I checked that the queue is created correctly. None of my code below launch modifies the queue, it accesses the queue. When I try to perform an operation any on the queue after the launch of VI, I get the following: «Get the status of the queue in Subsystem.lvclass:Message Handler.vi:640018-> Subsystem.lvclass:Controller.vi:4750017-> Subsystem.lvclass:Controller.vi.ACBRProxyCaller.A84000DB»

    I get similar messages to queue operations that I try to do. I also checked - for operations where I get an error - I have the same reference that was created during installation where my queue operations successfully. The only difference between VI and VI my problem Setup is that the problem VI VI I call through the CGRA.

    Any help that you could provide to me about what I'm doing wrong or if I'm trying to do something that cannot be done would be greatly appreciated!

    Thank you

    Ben

    If you actually tried to imitate the framework of the actor, you would have seen a comment explaining why the actor launched must create the queue.  Bascially, as soon as this launch VI hierarchy is complete, it is removed from memory.  This includes references, he has created.  So when the launch is completed, your queue reference becomes invalid.  Simple solution: make the actor called the queue as part of its initialization.  Then the queue will be valid as long as the actor is active.

Maybe you are looking for