-
Notifications
You must be signed in to change notification settings - Fork 55
Open
Description
code maybe like this:
class JavaTypeVisitor;
struct JavaType {
// ... other fields
virtual void accept(JavaTypeVisitor* visitor) = 0;
};
struct JavaInt : public JavaType {
virtual void accept(JavaTypeVisitor* visitor) override;
};
struct JavaLong : public JavaType {
virtual void accept(JavaTypeVisitor* visitor) override;
};
struct JavaObject : public JavaType {
virtual void accept(JavaTypeVisitor* visitor) override;
};
// ... other JavaType struct definitions
// visitor
class JavaTypeVisitor {
public:
virtual void visit(JavaInt* ji) = 0;
virtual void visit(JavaLong* jl) = 0;
virtual void visit(JavaObject* jo) = 0;
// ... visit other JavaTypes
};
// region gc
class GC {
public:
virtual void gc() = 0;
protected:
// ... some fields
};
class CMS_GC : public GC, public JavaTypeVisitor {
// ... some implementations
};
class G1_GC : public GC, public JavaTypeVisitor {
// ... some implementations
};
// ... other GC Implementation, eg: zgc
// endregion gc
Metadata
Metadata
Assignees
Labels
No labels