Prototype Constant pattern

Hi all,
I have problem compiling the following prototype constant pattern. The strange thing is that it compiles with JBuilder but not with the command line. I am using JDK1.4.1.
Thanks for any advice,
Vincent
package com.ascom.teamphone.MediaWrapper;
import com.ascom.teamphone.MediaWrapper.MediaImplementationC;
import com.ascom.teamphone.MediaWrapper.MediaFactoryC;
public class MediaFacadeC implements MediaFacadeC.Tone {
public interface Tone {
ToneType DTMF0 = new ToneType(0);
final class ToneType{ //final for type safety
private final int tone;
private ToneType(int i){
tone = i;
public int getIntTone(){
return tone;
protected MediaFacadeC() {} //Instanciation not allowed
java version is /appl/java/j2sdk1.4.1
Buildfile: build.xml
compile:
[javac] Compiling 227 source files to /home/project/teamphone/imp/classes
[javac] /home/project/teamphone/imp/src/com/ascom/teamphone/MediaWrapper/MediaFacadeC.java:8: cyclic inheritance involving com.ascom.teamphone.MediaWrapper.MediaFacadeC
[javac] public interface Tone {
[javac] ^

Sorry for that but I am not sure that I were the last
one!
Before saying anything else, just have a look at the
Java Tip 50 (Parameter Constants pattern). You might
be surprised!
http://www.javaworld.com/javaworld/javatips/jw-javatip5
.html?
Thaks for your compliments,
VincentI looked at that tip. It said in bold at the end of the summary:
"Editor's Note: The pattern described in this tip cannot be implemented in Java as of version 1.3. Be advised that Java will no longer allow cyclic inheritance of inner interfaces or classes."

Similar Messages

  • Best tool for Inverse Telecining and deinterlacing ?

    I have very limited experience in encoding videos before.
    Recently I'm trying to transcode a DVD into H.264 with x264. All the VOB files are dumped already.
    As for the video part, I've decided to do it this way :
    mkfifo TEMP.y4m
    x264 OPTIONS -o OUTPUT.mkv TEMP.y4m & mplayer -vo yuv4mpeg:file=TEMP.y4m OPTIONS INPUT.VOB
    I believe this method to be clean and efficient.
    The problem is: This VOB file is in NTSC format, and I'm pretty convinced that it's telecined, after reading this:
    http://www.doom9.org/ivtc-tut.htm wrote:TELECINE is a process where the FILM first is slowed down to 23.976 frames/second. Then for every 4 frames, an extra frame is created from fields of adjacent frames. If a frame consists of two fields, top (t) and bottom (b) and the original sequence is 1t1b 2t2b 3t3b 4t4b, then the telecined sequence would be 1t1b 2t2b 2t3b 3t4b 4t4b (commonly called 2:3 pull down because of the alternating 2 field, 3 field progression). This also means that the frame rate increases to 29.97 frames/second.
    I viewed the video frame by frame, and found out that there're 2 sequential interlaced frames out of every 5 in a non-static scene. These are 2t3b 3t4b frames I think.
    mplayer comes with some video filters that might help: With "-vf pp=" the result isn't that satisfying, but "-vf pullup" do the job nicely, that is, I can almost see no interlacing at all with this command:
    mplayer -vf pullup VTS_01_1.VOB -noconfig all
    On the other hand, I also noticed that there're 2 sequential repeated frames out of every 5 in a non-static scene. The frame-rate is 29.970 fps. This is bad because repeating means inefficiency in terms of compression. The better result is using only one of these 2 repeated frames at a frame-rate of 23.976 fps, which means dropping 20% extra frames.
    But I don't know how to achieve this.
    I want to achieve this at the mplayer decoding stage, so that x264 is fed with a yuv4mpeg source stream with no interlacing or extra frames.
    ------------------------------------------------------------------------------------------+
    I'm not familiar with mencoder's options, though it seems to be able to drop the extra frame with "-vf pullup,softskip -ofs 24000/1001", but I can't find a way to let mencoder output as yuv4mpeg. Also there is a reason why I tend to avoid using mencoder:
    mencoder -ss 209 -endpos 20 -ovc copy -oac copy -o _short_.vob VTS_01_1.VOB
    This is supposed to cut a 20-second short clip from the VOB using copy. But even task as this simple could be wrong...which is really disappoiting. Look at these 2 screen shots.
    By using mencoder -ovc copy::
    http://omploader.org/vMjE3Zw
    The original (mplayer VTS_01_1.VOB)::
    http://omploader.org/vMjE3aA
    Maybe it's just my build of mencoder(compiled at home)... But with this I really can't say mencoder is to be trusted.
    ...Or, is it something wrong in my command?
    -------------------------------------------------------------------------------------------+
    By the way, for this specific DVD, I believe mplayer plus x264 together can achieve the best result; on the other hand, just as the title suggests, I'd like to find some decent tool to do IVTC and Deinterlacing. CLI preferred but good GUI apps are also welcome
    Thanks in advance!
    Last edited by lolilolicon (2009-07-25 03:31:59)

    skottish wrote:You should be able to use the -vf pullup,softskip stuff still.
    man mplayer wrote:Softskip
    Only  useful  with MEncoder.  Softskip moves the frame skipping (dropping) step of encoding from before the filter chain to some point during the filter chain.  This allows filters which need to see all frames (inverse  telecine,  temporal  denoising,  etc.)
    Actually, when I tried::
    mplayer -vf pullup,softskip VTS_01_1.VOB -noconfig all
    The result is the same as just using "-vf pullup". The extra frame can't be dropped by mplayer this way......
    Too bad many "convenient" tools like h264enc all use mencoder. I don't know whether handbrake does too. Haven't tried it out.
    Avisynth is a great tool but works only for windows. x264's built in deinterlaced mode does no good in my case. ffmpeg's filters are still too limited by far. What can I do? Is there anything that does nothing but good IVTC?
    -------------------------------------------------------------------------------------+
    Klepper wrote:It says to always use the softskip filter together with pullup
    man mplayer wrote:Always  follow  pullup  with the softskip filter when encoding to ensure that pullup is able to see each frame.
    In my case, pullup seems to work better than filmdint: I've just tried the h264enc script which is almost totally a frontend to mencoder. Look at the mencoder filters it used:
    mencoder VTS_01_1.VOB -o 01.avi -fps 30000/1001 -ofps 24000/1001 -vf filmdint=fast=0/io=30:24/dint_thres=256,softskip,harddup -oac pcm -ovc x264 -x264encopts <x264OPTIONS>
    See, it also used filmdint as you suggust. The result is not too bad: removed the extra frame and plays at 24fps. But I can still notice interlacing occasionally. Maybe it's because the video isn't constant pattern "PPPII" but with some shifting (say, PPPIIPPPII...PPPIIPIIPPPIIPPPII, I found some pattern like this in the source VOB)
    Man page says "io=<ifps>:<ofps>" must match "-fps/-ofps" ("-fps 30000/1001" and "-ofps 24000/1001" in my case.)
    Since -ofps is an option ONLY for mencoder, but not for mplayer, filmdint can't make mplayer drop the extra frame like mencoder.
    I played the VOB with "mplayer -vf filmdint=fast=0/io=30:24 VTS_01_1.VOB -noconfig all" and there're lots of "@@@@@@@@ Bottom-first field??? @@@@@@@@" spitted out in the console. I read about this in the man page but don't understand....
    If the source is MPEG-2, [u]this must be the first filter to allow access to the field-flags set by the MPEG-2 decoder[/u]. Depending on the source MPEG, you may be fine ignoring this advice, as long as you do not see lots of "Bottom-first field" warnings.
    I don't have any other filters in the command line, so... why?
    The occasional interlacing is the same as the video encoded with h264enc. Also, it did not drop the extra frame anyway.
    -------------------------------------------------------------------------------------+
    Also I have a doubt:
    In my first post, I wrote:
    The original (mplayer VTS_01_1.VOB)::
    http://omploader.org/vMjE3aA
    But I think even this is not "original" -- not as good as the original video before it was telecined into NTSC format. I think it's mplayer not doing it good enough. The real original frame should have no blocking......
    I've compared it to one fansub rip, the same frame looks better than in the image above, very little blocking, also the bass string isn't blurred like in the image above:
    http://omploader.org/vMjE5aw
    I don't know how they did it. And I actually want to do it better
    Last edited by lolilolicon (2009-07-25 09:32:30)

  • Business Process Modelling Language Desirable Features

    Hi All,
    It will be quite interesting to see what features the BPX community would want to be in the “Visual” Business Process Modelling *** programming language which on one end use self-contained applications that use Web services as activities that implement business functions and on the other  has interactions with other J2EE like web components . 
    For example I would like to see something developed by SAP where the Business Process mapping can be done with a strict protocol in ARIES so that applications can be built in the Visual composer and the BPX can visually do the one or more of the following
    1.     On Screen “chain End Chain ” valdiation
    2.     Loop conditions
    3.     Branching conditions
    4.     Variable initialization
    5.     Web service message preparation
    The idea being the BPX can generate a running prototype for pattern based processes through grahhical interfaces and unless something really typical needs to be done, the coding can be eliminated.
    Taking an example:
    On a simple sales order if the stock is not adequate a purchase order needs to be fired.
    The Business process mapping of the same can be done in ARIES where some available components (business objects like sale order) from R3 etc are available for modeling.
    If this process is to be web enabled then one can use the business process modeling to develop a quick application in Visual Composer where one can use ESA for Sale Order as a Model and build screens based on that. The screen flow can also be built in Visual Composer to take you to through the various tabs.
    The data flow across the various tabs also can be done through the component controller and the BPX should be able to map that visually.
    The business event (Stock < Sale order quantity ) can be handled through a branching condition  and web service message preparation to either generate a email message or fire a purchase order (handled in XI and exposed in one common place of the Business Process modeling Tool).
    Marilyn : thanks for the offer of acting as a interface between the SAP development team and some of us with the wishlist. I would certainly love to be involved in the epochal development

    Why leaving the tool? Why ARIS and VC and CAF and many more different tools?
    I would prefer a tool that gives me - depending from the user - different flavors and views of my model. A tool that in one flavor allows me to define the process on a higher level, then in another flavor allows me to implement the application(s) of the process in a non-coding approach and then a flavor that allows me to pimp the application(s) with a coding approach.
    All three flavors are working on the very same model. The different flavors immediately see the changes done by other flavors. A kind of realtime modelling.
    The tool itself is not necessarily a single-environment approach, but can have one flavor running in the browser, the other one in a locally installed IDE. But still all of them use the same terminology. A data service here ,is a data service there, Business Object here is a Business Object there (and not a bean or a class or entity service etc.). That also would allow to have the different modeling users naturally move between the flavors, with a hard core programmer also being able to move to the Business Process Modeling tool, and the BPX also being able to write a small conversion routine.
    Perhaps the proper term is "BP & App Suite", which serves all types of modelers involved: Business Process Modelers, Business Process Experts, Developers.
    In the SAP world these tools could be: ARIS, Visual Composer, DevStudio/ABAP Workbench/.NET.
    Today this is not the case: we have more than 200 tools (and we say we are not a tools company) and not really an exchange of models between those tools. Not to mention the different terminology...

  • How to garantee that static data is initialized ?

    Hi,
    In order to implement the Prototype design pattern in Java I would like to automatically register the subclasses of Prototype to a static array of prototypes in the Prototype class.
    In C++ I use a static member in each subclass which is initialized by a static method which registers a prototype in the array of prototypes.
    It works in C++ because static data are initialized before main() is called.
    In Java though, to guarantee that static data is initialized it seems that each subclass needs to be loaded first which defeats the idea of automatic registration.
    Another solution to avoid mentionning subclasses names in the Prototype class would be to rely on the relfection API to get all its subclasses but I did not find any method to do that.
    Any hint ?
    Thanks in advance

    It depends what you call a key. In database systems a
    key is part of the data you are looking for.
    In order to get a specific prototype one of course
    needs information.
    Do we disagree here ?If you read the Prototype design pattern you will understand what I mean by key.
    The objective of the Prototype pattern is to decouple
    client code from which classes implement (or subclass)
    the Prototype interface (or abstract class).
    I disagree. It is a creational pattern. The intent of the Prototype pattern is to create a prototypical instance and create new objects by copying the prototype. The intent is not to decouple client code.
    Let's get back to my original question : is there a
    way in Java to register a class automatically to the
    collection of prototypes ?
    Using the reflection API gives an alternative solution
    (thanks to schapel).And I restate my orignal solution as my answer. Why would you want look through all or your classes to determine which ones where prototypes (sorry schapel)?
    If you have a known number of prototype subclasses then you can create and intialize them when the Prototype class is loaded.
    If not then you can use the key to determine if the prototype has been loaded, if not then the Prototype class can load the class. In this case, with some creativitity, you can create a key that meets your needs.
    It seems that you are dependent on the Prototype class containing all of the prototype classes at load time because you are using them to create user interface components. So your client (use interface) is directly coupled to your implementation of the Prototype, exactly what you said the Prototype design pattern incorrectly was intended to do.

  • Local Variables and INLINING

    LV2013SP1
    When making a VI that originates a TYPEDEF'ed cluster, I have always used a local variable of that output cluster, and a BUNDLE BY NAME function to insert the various pieces.
    Like this:
    Now, when I try to INLINE the VI that does this, I get an error message: "This object is not allowed in a VI on which you enable inlining".
    I can replace it with a constant easily enough:
    My questions are these:
    1... Why is the first method illegal?  I suspect something to do with thread-switching into the UI thread, is that it?  Or maybe there really isn't a front panel if it is INLINEd?
    2... Is the constant pattern better, in terms of memory usage?
    3... Is the constant pattern better, in terms of speed of execution?
    4... Should I adopt that pattern anyway, regardless of INLINE or not?
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

     the exact why is not explained
    I believe the "why" IS explained. This all makes sense to me now.
    There can be no instance of the control/indicator, because it's never been placed on the caller's panel.
    If it existed, it would have to have properties like POSITION and BOUNDS, and those have never been set.
    They COULD NOT be set, since they would have to be set (differently) for each instance of the inlined VI.
    The INLINEd VI requires REENTRANCY, that means there is a separate dataspace for each instance.
    I suppose that dataspace now would come from the caller.
    The point of the INLINE is to connect the caller's output wire to the VI's input wire AS IF the VI's code were copied into the caller.
    That means that the CONTROL/INDICATOR is totally unnecessary, and can be removed.
    It therefore cannot be accessed.  Not by property nodes. Not by local vars.
    AND, ON A HUNCH, I tested this:  NOT BY REFERENCE.
    With a REFERENCE to a control/indicator on an INLINEd VI, I get the same error: this object is not allowed in a VI on which you enabled INLINING.
    Because it doesn't exist.
    The control/indicator is a metaphor for the interface between the code and the screen display.  It ceases to exist when INLINEd.
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • Anyone Know A Timeline Track Height Shortcut?

    I use "Shift T" all the time as a keyboard shortcut for changing the track height in the timeline but I would love to find a shortcut for just changing the height of a selected track or group of selected tracks in a uniform fashion other than dragging each timeline manually. Is there a quicker way?
    Any ideas?

    Thanks, but using Save Track Height feature is restrictive and assumes that you want to view a constant set of tracks or a constant pattern of tracks.
    It would great if the option was avaliable to use the "Shift T" shorcut in combination with other keys to specify tracks e.g. Just Video or Just Audio or Just A1, A3, A5 etc. Much as you can toggle Targeting or Auto Select with the keyboard.

  • Connection tarpit on outbound (spamming)

    Hi guys,
    Sorry if it has been discussed before. But I am really looking forward to having the ability to use connection tarpit as used in Sendmail. (aka ratecontrol).
    This is quite fundamentally different in characteristic than "Recipients per hour"
    In fact, to combat with "Outgoing spamming", this ratecontrol is more effective. Outgoing spamming have a very constant pattern of sending spam (and virus) via continuous rate.
    Sendmail ratecontrol IS - a tarpitting concept. Once the rate is reached , an IP must wait a time delay before ANY new connection is to be accpted
    Recipient control IS - a queuing concept. Once there is an "free" ticket in the last hour, your connection will be accpted and IRpt will try to deliver as it should be.
    With the "continuous" spamming in mind. The sendmail thing is more effective.
    We use both here.
    Any comment here from all the gurus?

    To add a note here.
    1. Being able to stop outgoing spamming IS also very important, but it is quite clear that we cannot use SRBS on the dialup lines (we want to treat our customers good and fair).
    By fair, we mean, one can dialup and use the line for spamming a while, but we couldn't just use SRBS (history!) to limit its outgoing because another one may dial and connect it just as normal
    2. Sendmail ratecontrol window is reset if one *tries* to send again during its tarpit period. i.e. continiuous spamming will be defeated after the first windowing, because subsequent spamming will keep the timer being reset.

  • Example for Prototype pattern

    Hi All,
    Can anybody give me an simple, pratical example and a sample code to understand prototype pattern.
    I need a simple example with code.
    Thanks,
    J.Kathir

    public interface Prototype {
          public void someFunction();
          public Object clone();
    public class Foo {
         private Prototype p;
         public static void main(String[] args) {
                p = new SomePrototype();
                Prototype x = (Prototype)p.clone();
                x.someFunction();
                p = new SomeOtherPrototype();
                x = (Prototype)p.clone();
                x.someFunction();
    }

  • How Prototype pattern is reducing number of subclasses

    Hi
    can u please explain by some examples how prototype pattern are useful in reducing no of subclasses and how it is useful to avoid building a class hierarchy of factories that parallels the class hierarchy of products
    Please give some practical examples to explain protoype pattern.
    Thanks in advance.

    http://www.dofactory.com/Patterns/PatternPrototype.aspx

  • When should we use prototype pattern?

    I know object cloning is a concrete usage, but when we should use that?

    Since this is a java forum the following from GoF is relevant...
    "Prototype is particularly useful with static languages like C++...and little or no type information is available at run-time...It's less important in languages...that provide what amounts to a a prototype (i.e, a class object) for creating instances of each class."
    Java of course has java.lang.Class and has plenty of type information.
    Cloning is a very special case that is outside normal java.

  • Design Patterns, The Decorator

    When trying to implement the classic decorator design patterns your decorator executable might look like this:<br><br>
    <pre>
      METHOD validate.
        DATA: Validator TYPE REF TO validation_manager.
       CREATE OBJECT:
         Validator TYPE validation_manager.
        ,Validator TYPE validate_format                 EXPORTING x_validator = Validator
        ,Validator TYPE validate_values                 EXPORTING x_validator = Validator
        ,Validator TYPE validate_relation_input       EXPORTING x_validator = Validator
        ,Validator TYPE validate_relation_database EXPORTING x_validator = Validator.
        me->lst_result = validator->validate( me->lst_data ).
        WRITE: / 'Processing Validate Activity'.
      ENDMETHOD.                    "validate</pre><br><br>
    The validate method ends up in endless resurcion in the memory. The reason is that I'm using the same variable as the resulting instanse and as parameter. It seems like the constructor treats both the result and the parameter as the same field/instanse regardless import parameter such as VALUE/REFERENCE. If I change the method to use an extra field in the method validate like:
    <br><br><pre>
      METHOD validate.
        DATA:
          validator  TYPE REF TO validation_manager
         ,recursive  TYPE REF TO validation_manager.
        CREATE OBJECT validator TYPE validation_manager.
        recursive ?= validator.
        CREATE OBJECT validator TYPE validate_format
          EXPORTING x_validator = recursive.
        recursive ?= validator.
        CREATE OBJECT validator TYPE validate_values
         EXPORTING x_validator = recursive.
        recursive ?= validator.
        CREATE OBJECT validator TYPE validate_relation_input
          EXPORTING x_validator = recursive.
        recursive ?= validator.
        CREATE OBJECT validator TYPE validate_relation_database
          EXPORTING x_validator = recursive .
        recursive ?= validator.
        me->lst_result = validator->validate( me->lst_data ).
        WRITE: / 'Processing Validate Activity'.
      ENDMETHOD.                    "validate</pre><br><br>
    Now the decorator engine works, but why does the first implementation not work when the same one executes fine in php, c++, delphi, java and other languages.<br><br>
    If you do not know what I'm trying to discuss, look up "Design Patterns - Simply", and jump to the chapter about the decorator design pattern. I'm trying to use this design pattern for a validation manager within my Business Process Engine, which needs to be able to configure what types of validation needed for on specific process (BPMN).<br><br>

    Hi Matt, Thanks for the formatting..:) I will post the complete program as it's only a prototype program. Trying to get the format under control.
    </body>
    Report  ZDP_DECORATOR_XMP01
    REPORT  zdp_decorator_xmp01.
    parameters: bestimpl  TYPE boolean_01 default 0.
    TYPES:
      BEGIN OF processdata
       ,name   TYPE char30
       ,street TYPE char30
       ,zip    TYPE char5
       ,city   TYPE char30
       ,email  TYPE char50
       ,phone  TYPE char20
    ,END OF processdata
    ,BEGIN OF result
       ,msgid  TYPE msgid
       ,msgtyp TYPE msgty
       ,msgno  TYPE msgno
       ,status TYPE char1
    ,END OF result.
    CONSTANTS:
    true     TYPE boolean_01 VALUE 1
    ,false    TYPE boolean_01 VALUE 0.
    CLASS validationmanager DEFINITION
    CLASS validation_manager DEFINITION.
      PUBLIC SECTION.
        METHODS:
          validate
            IMPORTING
              x_data             TYPE processdata
            RETURNING
              value(y_result)    TYPE result.
    ENDCLASS.
    CLASS validationmanager IMPLEMENTATION
    CLASS validation_manager IMPLEMENTATION.
      METHOD validate.
        WRITE: / 'Common validation'.
      ENDMETHOD.                    "validate
    ENDCLASS.
    CLASS Validate_Decorator DEFINITION
    CLASS validate_decorator DEFINITION INHERITING FROM validation_manager ABSTRACT .
      PUBLIC SECTION.
        DATA: validator TYPE REF TO validation_manager.
    ENDCLASS. 
    CLASS validate_format DEFINITION
    CLASS validate_format DEFINITION INHERITING FROM validate_decorator.
      PUBLIC SECTION.
        METHODS:
          constructor
           IMPORTING value(x_validator) TYPE REF TO validation_manager
         ,validate REDEFINITION.
    ENDCLASS.   
    CLASS validate_format IMPLEMENTATION
    CLASS validate_format IMPLEMENTATION.
      METHOD constructor.
        CALL METHOD super->constructor( ).
        me->validator = x_validator.
      ENDMETHOD.                    "constructor
      METHOD validate.
        y_result = validator->validate( x_data ).
        IF y_result-status IS INITIAL.
          WRITE: / 'Now doing the format checks'.
        ENDIF.
      ENDMETHOD.                    "validate
    ENDCLASS.
    CLASS validate_values DEFINITION
    CLASS validate_values  DEFINITION INHERITING FROM validate_decorator.
      PUBLIC SECTION.
        METHODS:
          constructor
           IMPORTING value(x_validator) TYPE REF TO validation_manager
         ,validate REDEFINITION.
    ENDCLASS.
    CLASS validate_values IMPLEMENTATION
    CLASS validate_values IMPLEMENTATION.
      METHOD constructor.
        CALL METHOD super->constructor( ).
        me->validator = x_validator.
      ENDMETHOD.                    "constructor
      METHOD validate.
        y_result = validator->validate( x_data ).
        IF y_result-status IS INITIAL.
          WRITE: / 'Now doing the values checks'.
        ENDIF.
      ENDMETHOD.                    "validate
    ENDCLASS. 
    CLASS validate_relation_input DEFINITION
    CLASS validate_relation_input DEFINITION INHERITING FROM validate_decorator.
      PUBLIC SECTION.
        METHODS:
          constructor
           IMPORTING value(x_validator) TYPE REF TO validation_manager
         ,validate REDEFINITION.
    ENDCLASS.
    CLASS validate_relation_input IMPLEMENTATION
    CLASS validate_relation_input IMPLEMENTATION.
      METHOD constructor.
        CALL METHOD super->constructor( ).
        me->validator = x_validator.
      ENDMETHOD.                    "constructor
      METHOD validate.
        y_result = validator->validate( x_data ).
        IF y_result-status IS INITIAL.
          WRITE: / 'Now doing the relation input checks'.
        ENDIF.
      ENDMETHOD.                    "validate
    ENDCLASS.
    CLASS validate_relation_database DEFINITION
    CLASS validate_relation_database DEFINITION INHERITING FROM validate_decorator.
      PUBLIC SECTION.
        METHODS:
          constructor
           IMPORTING value(x_validator) TYPE REF TO validation_manager
         ,validate REDEFINITION.
    ENDCLASS.  
    CLASS validate_relation_database IMPLEMENTATION
    CLASS validate_relation_database IMPLEMENTATION.
      METHOD constructor.
        CALL METHOD super->constructor( ).
        me->validator = x_validator.
      ENDMETHOD.                    "constructor
      METHOD validate.
        y_result = validator->validate( x_data ).
        IF y_result-status IS INITIAL.
          WRITE: / 'Now doing the relation database checks'.
        ENDIF.
      ENDMETHOD.                    "validate
    ENDCLASS.  
    CLASS process_execution DEFINITION
    CLASS process_execution DEFINITION.
      PUBLIC SECTION.
        METHODS:
          startevent
         ,getdata
         ,validate
         ,process
         ,endevent.
      PRIVATE SECTION.
        DATA:
          lst_data   TYPE processdata
         ,lst_result TYPE result.
    ENDCLASS.                    "process_execution DEFINITION
    CLASS process_execution IMPLEMENTATION
    CLASS process_execution IMPLEMENTATION.
      METHOD startevent.
        WRITE: / 'Processing startevent'.
      ENDMETHOD.                    "startevent
      METHOD getdata.
        me->lst_data-name        = 'Hans Andersen'.
        me->lst_data-street      = 'H.C Andersens Boulevard 112'.
        me->lst_data-zip         = '1557'.
        me->lst_data-city        = 'København'.
        me->lst_data-email       = 'hcATandersen.dk'.
        me->lst_data-phone       = '0045-31162211'.
        WRITE: / 'Processing Get_Data Activity'.
      ENDMETHOD.                    "getdata
      METHOD validate.
        DATA:
          validator  TYPE REF TO validation_manager
         ,recursive  TYPE REF TO validation_manager
        IF bestimpl = true.
          CREATE OBJECT:
            validator TYPE validation_manager
           ,validator TYPE validate_format EXPORTING x_validator = recursive
           ,validator TYPE validate_values EXPORTING x_validator = recursive
           ,validator TYPE validate_relation_input EXPORTING x_validator = recursive
           ,validator TYPE validate_relation_database EXPORTING x_validator = recursive.
        ELSE.
          CREATE OBJECT validator TYPE validation_manager.
          recursive ?= validator.
          CREATE OBJECT validator TYPE validate_format
            EXPORTING x_validator = recursive.
          recursive ?= validator.
          CREATE OBJECT validator TYPE validate_values
           EXPORTING x_validator = recursive.
          recursive ?= validator.
          CREATE OBJECT validator TYPE validate_relation_input
            EXPORTING x_validator = recursive.
          recursive ?= validator.
          CREATE OBJECT validator TYPE validate_relation_database
            EXPORTING x_validator = recursive .
          recursive ?= validator.
        ENDIF.
      Recursive call of the validate and it's successors
        me->lst_result = validator->validate( me->lst_data ).
        WRITE: / 'Processing Validate Activity'.
      ENDMETHOD.                    "validate
      METHOD process.
        WRITE: / 'Processing Process Activity'.
      ENDMETHOD.                    "process
      METHOD endevent.
        WRITE: / 'Processing endevent'.
      ENDMETHOD.                    "endevent
    ENDCLASS.    
    CLASS mainapp DEFINITION                                             *
    CLASS mainapp DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          main.
    ENDCLASS.   
    CLASS mainapp IMPLEMENTATION                                         *
    CLASS mainapp IMPLEMENTATION.
      METHOD main.
        DATA:
          p89 TYPE REF TO process_execution.
        CREATE OBJECT p89.
        p89->startevent( ).
        p89->getdata( ).
        p89->validate( ).
        p89->process( ).
        p89->endevent( ).
      ENDMETHOD.  
    ENDCLASS.     
    START-OF-SELECTION.
      mainapp=>main( ).
    Edited by: Matt on Dec 22, 2009 2:03 PM Fixed formatting

  • Missing prototype and Undefined Symbol errors

    So, I am using an Opal Keyy XEM3005 board.
    Depending on the documentation I read, this board has a native ANSI C interface with a C++ wrapper.
    In their forums, they say to rename the ".cpp" file to "c", and then go forward with calling the default constructor & keep track of the pointer.  Their functions are all in an externally loadable DLL.
    Well and good.
    Their API documentatin is available here:  http://www.opalkelly.com/library/FrontPanelAPI/
    I have written a REALLY simple app to ease my way in - it does nothing more than allow the user to throw a switch, and when this happens, it goes off to connect to the board:
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    #include <cvirte.h>
    #include <userint.h>
    #include "Try1.h"
    #include "XEM.h"
    #define _WIN32_WINNT 0x0501
    //#define _WIN32
    #include <windows.h>
    static int panelHandle;
    static okFrontPanel_HANDLE    XEM_Device;
    int __stdcall WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPSTR lpszCmdLine, int nCmdShow)
    if (InitCVIRTE (hInstance, 0, 0) == 0)
    return -1;    /* out of memory */
    if ((panelHandle = LoadPanel (0, "Try1.uir", PANEL)) < 0)
            return -1;
        DisplayPanel (panelHandle);
        RunUserInterface ();
        DiscardPanel (panelHandle);
        return 0;
    int CVICALLBACK Connect (int panel, int control, int event,
            void *callbackData, int eventData1, int eventData2)
        int    Value = 0;
        switch (event)
            case EVENT_COMMIT:
                GetCtrlVal(PANEL, PANEL_CONNECT_SWITCH, &Value);
                SetCtrlVal(PANEL, PANEL_CONNECT_LED, Value);
                if( Value )
                    XEM_Connect(XEM_Device);
                else
                    XEM_Disconnect(XEM_Device);
                break;
        return 0;
    int CVICALLBACK Quit (int panel, int control, int event,
            void *callbackData, int eventData1, int eventData2)
        switch (event)
            case EVENT_COMMIT:
                QuitUserInterface (0);
                break;
        return 0;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    This, of course, works fine by itself (with empty _Connect() and _Disconnect() functions)
    I then started working with the XEM_Connect function.
    The first step is to run their LoadDLL function as such:
    int XEM_Connect ( okFrontPanel_HANDLE    XEM_Device )
        int    NoDevices = 0;    //    Number of devices attached to the PC
        //    Load the DLL (?)
        // Load the FrontPanel DLL
        if (FALSE == okFrontPanelDLL_LoadLib(NULL))
            printf("Could not load FrontPanel DLL\n");
            exit(-1);
        return XEM_SUCCESS;
    And this would compile and run just fine.
    Now, when I added the functions to start trying to get info about the device, I started getting "missing prototype" errors.
    int XEM_Connect ( okFrontPanel_HANDLE    XEM_Device )
        int    NoDevices = 0;    //    Number of devices attached to the PC
        //    Load the DLL (?)
        // Load the FrontPanel DLL
        if (FALSE == okFrontPanelDLL_LoadLib(NULL))
            printf("Could not load FrontPanel DLL\n");
            exit(-1);
        //    Find out how many devices are attached
        XEM_Device = okFrontPanel_Construct(  );
    //    XEM_Device = okCFrontPanel( void );
    //    NoDevices = GetDeviceCount( );
        printf("%d OK devices attached\n", NoDevices);
        //    Call the contructor?    
    //    okCFrontPanel ();
        return XEM_SUCCESS;
    Now, I searched the forums and found the bits about adding #define _WIN32_WINNT 0x0501 prior to inclusion of windows.h.  Did that.  No joy.
    Then I searched some more and found the bit about changing the build options to uncheck the "prototype required" flag.
    Done.
    This seemed to work at first (the above code could be built with no errors, and appeared to run).
    So I thought maybe I had it, and added the next line, so:
    int XEM_Connect ( okFrontPanel_HANDLE    XEM_Device )
        int    NoDevices = 0;    //    Number of devices attached to the PC
        //    Load the DLL (?)
        // Load the FrontPanel DLL
        if (FALSE == okFrontPanelDLL_LoadLib(NULL))
            printf("Could not load FrontPanel DLL\n");
            exit(-1);
        //    Find out how many devices are attached
        XEM_Device = okFrontPanel_Construct(  );
        OpenBySerial( XEM_Device, "UaLgzvVpBJ" );
    //    XEM_Device = okCFrontPanel( void );
    //    NoDevices = GetDeviceCount( );
        printf("%d OK devices attached\n", NoDevices);
        //    Call the contructor?    
    //    okCFrontPanel ();
        return XEM_SUCCESS;
    Now it doesn't complain about no prototypes (duh), but instead I get linker errors:
        Undefined symbol '_OpenBySerial@0' referenced in "XEM.c".
    So, dredging through the .h and .c files, I found a couple of things:
    in the okFrontPanel.c file I found the following:
    okDLLEXPORT ok_ErrorCode DLL_ENTRY
    okFrontPanel_OpenBySerial(okFrontPanel_HANDLE hnd, const char *serial)
        if (_okFrontPanel_OpenBySerial)
    ;  return((*_okFrontPanel_OpenBySerial)(hnd, serial));
        return(ok_UnsupportedFeature);
    In the okFrontPanel.h file I found:
    and also:
    okDLLEXPORT ok_ErrorCode DLL_ENTRY okFrontPanel_OpenBySerial(okFrontPanel_HANDLE hnd, const char *serial);
    So, I see them in the .h & .c files, but the linker is bombing out.
    I smell a problem with actual code to link being in the DLL...  How do I resolve this, any ideas?  Or am I doing something so stupidly (and obviously) wrong that I'm being blinded to it?

    Hi tomii,
    My suspicion is that these issues are due to using a C++ dll in a C environment. There are inherent challenges with performing such an operation as you have to make sure all your parameters and settings are correct.
    I also could not find the documentation that the Opal Kelly dll is ANSI C but it sounds like you can use this in C with some reconfiguration. I would recommend using their forums to get more information on what steps need to take place to get things working in ANSI C.
    From the information you provided, I did find some resources on the missing prototype error and undefined symbol issue with the linker.
    For the missing prototype I found a thread of someone actually using LabWindows and seeing this compiler error you may want to look at
    http://bytes.com/topic/c/answers/695019-missing-prototype
    I found a few cases where using a function definition of int func(void) removes such issue when int func() does not.
    Another link I found that may be worth a look can be found at http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html
    It gives some good pointers to mixing C and C++ code. Some of it may be applicible in your case.
    And, a resource for your undefined symbol linking issue.
    http://www.cprogramming.com/tutorial/compiler_linker_errors.html
    Hopefully these resources will give some context for getting things compiling and working with your dll.
    Good luck!
    James W.
    Applications Engineer
    National Instruments

  • How do I pass an array of structs to a C function using the dll flexible prototype adapter?

    What I want to do is pass into a C dll function a variably sized Array of structs of type TPS_Data. My Code compiles but when I run it in TestStand, I get an error -17001; Program Error. "Cannot allocate 0 size buffer Error in parameter 2, 'OpenFrdData'."
    I've allocated the Array of structs, and all of the information is there before I call my function, so is it my prototype? Or am I asking too much of the DLL Flexible Prototype Adapter to pass an Array of Structs?
    I can pass in a single struct of type TPS_Data and that works, but not an array.
    Here's the relevent code:
    typedef struct TPS_DATA
    char Report_Number[256];
    char System_Name[256];
    char Open_Date[256];
    char UUT_Part_Number[256];
    char UUT_Serial_Number[256];
    char UUT_Name[256];
    char Open_Employee_Name[256];
    char Open_Employee_Number[256];
    char Close_Employee_Name[256];
    char Close_Employee_Number[256];
    char Close_Date[256];
    } TPS_Data;
    typedef struct TPS_DATA_ARRAY
    TPS_Data DataRecord;
    } TPS_DataArray;
    long __declspec(dllexport) __stdcall OpenDialog (CAObjHandle Context, TPS_DataArray *TpsData[], const char *psFaultStr, char *sComments, const int nCount);

    OK,
    I can pass the data to the DLL function, using the following types:
    typedef struct StringArrayType
    char string[10][256];
    } StringArray;
    typedef struct MultiStringArrayType
    StringArray Record[10];
    } MultiStringArray;
    void __declspec(dllexport) __stdcall ATP_TestStructPassing(StringArray Strings)
    return;
    void __declspec(dllexport) __stdcall ATP_TestMultiStructPassing(MultiStringArray *Strings)
    return;
    But when the MultiStruct function Exits, TestStand reports an Error:
    -17501 "Unexpected Operating System Error" Source: 'TSAPI'
    There doesn't seem to be a way around this, and once the error occurs, I have to force quit TestStand. I've included the sequence file, and the dll code can be compiled from the fun
    ctions shown above.
    Any thoughts on how to get around this error would be greatly appreciated.
    Attachments:
    StructArrayPassing.seq ‏16 KB

  • Right way of defining constants - Interfaces or Classes?

    Two widely used ways to define constants in java projects are:
    1. Interfaces - Define constants in interfaces, they automatically become static, final and then implement the interface in concrete classes that need those constants.
    2. Classes - Use normal classes and define explicitly as static, final. Use CLASS_NAME.CONSTANT_NAME to access the constant in concrete classes.
    I have gone through the web on Best-practices for defining constants and its strongly recommended for not using Interfaces for defining constants.
    "The constant interface pattern is a poor use of interfaces. That a class uses some constants internally is an implementation detail. Implementing a constant interface causes this implementation detail to leak into the class's exported API. It is of no consequence to the users of a class that the class implements a constant interface. In fact, it may even confuse them. Worse, it represents a commitment: if in a future release the class is modified so that it no longer needs to use the constants, it still must implement the interface to ensure binary compatibility. If a nonfinal class implements a constant interface, all of its subclasses will have their namespaces polluted by the constants in the interface. " from     Effective Java, Joshua Bloch
    What is your take on this?
    Rgds

    I have gone through the web on Best-practices for defining constants and its strongly recommended for not using Interfaces for defining constants.
    "The constant interface pattern is a poor use of interfaces. That a class uses some constants internally is an implementation detail. Implementing a constant interface causes this implementation detail to leak into the class's exported API. It is of no consequence to the users of a class that the class implements a constant interface. In fact, it may even confuse them. Worse, it represents a commitment: if in a future release the class is modified so that it no longer needs to use the constants, it still must implement the interface to ensure binary compatibility. If a nonfinal class implements a constant interface, all of its subclasses will have their namespaces polluted by the constants in the interface. " from     Effective Java, Joshua Bloch
    I don't like grouping constants into an interface. I prefer keeping them closer to the classes that use them.
    %

  • How to change the transmissi​on rate of data flow in producer/ consumer pattern

    Hi All
    I am new to labview and trying to design a application to transfer image data in different rates, that means I can change the transfer rate in the transmission process. In fact,I refer to the the Queue Basic.vi to achieve this function by Changing the delay value of dequeue and enqueue.The program is divided into three parts:
    The first part is the sender in vc used to split and send image data.Data size is 226kb and each time we send a 1kb packet;
    The second is labview rate-change part,use producer/ consumer pattern and queue to transfer data;
    The third one is the receiver in vc,receive data in sequence and synthetic images.
    The entire transfer process is: image data was sent from the sender to producer loop through DLL, then enqueue--dequeue in consumer loop--DLL--receiver.The sleep time in vc sender is equal to the delay value in producer loop and this makes it look like the data generated as in the loop.
    Now this is where my dilemma is:
    When transferring data, if the producer loop and consumer loop delay value are equal(both 20ms), I can see image synthesis at a constant speed and no data lose; if I change the consumer loop delay value and make it greater than the producer delay(one is still 20ms and another is 50ms),that means receive in a lower rate and store data in queue. I can see Elements in Queue
    increase but the image data randomly lost, and the image synthesis speed is not reduced.
    My question is why image data loss and I can't see the image synthesis speed reduced when change the delay value in consumer loop?
    Do anyone know how to solve the problem? Are there any examples I can refer to? Any suggestions are greatly appreciated!
    Attachments:
    image1.JPG ‏56 KB

    thisoldman,
    I don't have '/usr/lib/modules/3.17.3-1-ARCH/build/Documentation/VGA-softcursor.txt' on my file system. Does it contain the info about changing the blinking speed?
    P.S. The other two links I found yet before starting this thread. I only found in them the recommendations about changing "the color and shape of the cursor and turning blinking on/off" (as I mentioned in the original question). Did I miss the info about the blinking speed?
    PPS: I found the vga-softcursor.txt here: https://www.kernel.org/doc/Documentatio … cursor.txt
    But that file doesn't tell about changing the blink rate either.
    Last edited by nbd (2014-11-23 20:55:41)

Maybe you are looking for

  • Executing commands read from text file

    I'm trying to execute full command lines that I am reading in from a text file. For example, each line in the file contains a full call to a method that I have already written, including arguments. I have opened the text file, can read in line by lin

  • HTTP/1.1 500 Internal Server Error.......content-type: text/html;charset=ut

    Hi I have created one web service... while i am testing in WSNAVIGATOR i am getting the following error......... <b>Request</b> POST /sap/bc/srt/rfc/sap/ZZ_BAPI_CUSTOMER_DISPLAY?sap-client=100 HTTP/1.1 Host: SAPDEV:8000 Content-Type: text/xml; charse

  • Photo Transfer  PE 7 to PE11

    How do I import PE 7 photos into PE 11 on my new Win 7 computer?

  • BALANCE SHEET IN SAP?

    Does anyone know the transaction code to run a simple Balance Sheet in SAP. Are there Balance Sheet reports within SAP or are they in the Business Warehouse. Any information would be greatly appreciated. Thanks, Linda

  • New pacman version

    Not sure who the pacman dev(s) is, but I just wanted to say thanks for the development of a great application. The new version with the total size (on -Su), it something that never really occurred to me, but now that its there, I _really_ appreciate