I'm going to answer this out of line because I want to answer the last
question first.

The problem with the compile error results in how RexxActivation is defined
in Activity.hpp. It's declaration is just "class RexxActivation", which
tells the compiler that RexxActivation is a class...and nothing else. This
allows RexxActivation * to be used in prototypes since there is enough
information available for that purpose. To get the full definition of
RexxActivation, you would need to replace "class RexxActivation" with
"#include "RexxActivation.hpp". However, I suspect doing that will result
in some circular dependencies between the two header files. Any you would
probably need to define Activity as friend to the RexxActivation class to
make that enum visible.

Given the relationship between RexxActivation and Activity, and that both
classes need the information, having the enum defined in RexxActivation
feels like the wrong place to for that to be located. It feels like it
should belong in Activity. However, those values are really only used for
things created for RexxActivation.

A better solution would be to refactor the code a bit.
Activity::traceOutput() . The first two lines of TraceOutput deal with the
creation of the TraceObject, which really should be something that the
RexxActivation is responsible for. Move the stuff involved with that to
RexxActivation and then only pass the constructed TraceObject to the
traceOutput() method which is now just responsible for handling the output.
Now there's no need for TracePrefix to be visible outside of
RexxActivation.

Oh, and in the process, could you please make CreateTraceObject() into a
method of RexxActivation? Doing things via functions really doesn't belong
in this code base.

Rick



On Thu, Jul 11, 2024 at 11:24 AM Rony G. Flatscher <rony.flatsc...@wu.ac.at>
wrote:

> The enum TracePrefix type gets defined RexxActivation.hpp and is public
> (needs to be used from RexxActivation.cpp and Activit.cpp).
>
> What is the proper way to become able to refer to the enum TracePrefix in
> Activity.hpp and Activity.cpp?
>
> Currently "Activity.hpp" defines the prototype for traceOutput(...) as
>
> void traceOutput(RexxActivation *, RexxString *, RexxString *, RexxObject *, 
> RexxObject *);
>
> and should be changed to allow for a TracePrefix argument as the third
> argument, hence trying to:
>
> void traceOutput(RexxActivation *, RexxString *, TracePrefix, RexxString *, 
> RexxObject *, RexxObject *);
>
> If doing so the compiler yields an error "error C2664: ... cannot convert
> argument 3 from 'RexxActivation::TracePrefix' to 'TracePrefix'".
>
> Therefore changing the prototype to
>
>  void traceOutput(RexxActivation *, RexxString *, 
> RexxActivation::TracePrefix, RexxObject *, RexxObject *, RexxObject *);
>
> yields the compiler error messages:
>
> ...\Activity.hpp(210): error C2027: use of undefined type 'RexxActivation'
> ...\Activity.hpp(73): note: see declaration of 'RexxActivation'
>
> The type "RexxActivation" can be used in Activity.hpp (defines at the top
> "class RexxActivation;") do define prototypes.
>
> ---
>
> The question: what needs to be defined where in order to become able to
> reference the enum TracePrefix from Activity.hpp and Activity.cpp without
> an error?
>
> ---rony
>
>
> _______________________________________________
> Oorexx-devel mailing list
> Oorexx-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to