Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8904185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:03:46+00:00 2026-06-15T02:03:46+00:00

I have a class called ToolConfigurationVector and a class called JointVariableVector . I need

  • 0

I have a class called ToolConfigurationVector and a class called JointVariableVector.
I need to be able to convert between those two classes (they are different representations of the same data)

A ToolConfigurationVector consists only of 6 primitive Datatypes. This is always the case.

A JointVariableVector is a representation that is specific to a Robotarm, represented by the class Arm.

So for one subclass of Arm (say SimpleArm) the representation and thus the conversion to ToolConfigurationVector is completely different to representation and conversion of another subclass of Arm (say ComplexArm)

Later, I want to use those classes like this:

Arm * someArm = new ComplexArm();
// ...
JointVariableVector jvv = someArm.currentJointVariableVector();
ToolConfigurationVector tcv = jvv.toToolConfigurationVector(); // no problem using virtual function
JointVariableVector how = tcv.toJointVariableVector(); // how?

I don’t want to include any information about which subclass of Arm is in use into ToolConfigurationVector, the information should be stored somehow in JointVariableVector

Of course, I could use templates like this:

JointVariableVector<ComplexArm> how = ...

But this is not applicable in my case, I have to solve this using ONLY

  • someArm
  • tcv
  • ToolConfigurationVector
  • JointVariableVector

I could of course give Arm a virtual method like jointVariableVectorFromToolConfigurationVector(ToolConfigurationVector v) but I cannot make it static, and because it has nothing to do with the actual Arm object implementing it as method (without static) seems wrong to me.

What can I do to get an elegant solution? Of course, this solution should be efficient, too (in terms of needed classes, objects and execution time).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T02:03:48+00:00Added an answer on June 15, 2026 at 2:03 am

    From jvv.toToolConfigurationVector(); // no problem using virtual function it indicates that JointVariableVector holds a pointer or reference to an Arm subclass instance, or it is using something like the pImpl pattern, in order to engage in behavior virtual in the Arm subclass that it was created from.

    If you want ToolConfigurationVector::toJointVariableVector to create a class which is virtual in what subclass of Arm it is specific to, either (A) ToolConfigurationVector must be virtual in which subclass of Arm the JointVariableVector will be virtual in that it produces, or (B) ToolConfigurationVector::toJointVariableVector needs to be supplied an Arm to create the JointVariableVector which will be virtual in the Arm subclass. Ie, pass an Arm to toJointVariableVector.

    Alternatively, the JointVariableVector could be some kind of virgin object which later needs to be blessed with Arm context before it makes sense, but that makes a mess.

    So, to be clear, JointVariableVector either has a pointer to an Arm (because its representation is a function of said Arm), or is a pImpl pattern class, based off your syntax (where instances of JointVariableVector, and not pointers to same, invoke virtual behavior). How said JointVariableVector is built is a function of the Arm it comes from. The ToolConfigurationVector loses that information. To rebuild a JointVariableVector you must then inject the Arm back into the situation.

    If JointVariableVector is only a function of the type of the Arm (and not on the instance), then you can make toJointVariableVector a template function on the type of Arm it is creating a JointVariableVector for. To reduce ToolConfigurationVector dependency on Arm subclasses, have ToolConfigurationVector dispatch the call to a free template function on the type of Arm, which you can then implement adjacent to each Arm subclass and change the JointVariableVector produced.

    Which would give you the syntax:

    Arm * someArm = new ComplexArm();
    // ...
    JointVariableVector jvv = someArm.currentJointVariableVector();
    ToolConfigurationVector tcv = jvv.toToolConfigurationVector();
    JointVariableVector how = tcv.toJointVariableVector<ComplexArm>();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class called: ComplexNumber and I have a string that I need
I have one class called Global and two other activities. In each activity I
I have a class called Property that I only need to display a few
I have one class called Requestparent. I have 3 classes called requesttype1, requesttype2, requesttype3,
I have a class called File that is defined (along with other classes) in
I have class name called Address in two namespaces. Its been two EDMX files,
I have a class called Trial which has_many results. Now What I want to
I have a class called Account public class Account { public double balance =
I have a class called Metadata, which is declared within the namespace A::B::C ,
I have a class called Flamethrower which naturally has its own ammunition that is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.