Ada远程“U类型错误”;非法重写从接口“”继承的子程序;

Ada远程“U类型错误”;非法重写从接口“”继承的子程序;,ada,Ada,我正在开发一个数据库管理系统(数据库管理软件)完全在Ada和DSA。 但是我遇到了一些问题;行被实现为文档(MongoDB样式),它们是受保护的接口,然后作为受保护的类型在同一个包中实现。 我必须先把它做成一个接口,这样它才有可能有一个远程访问类型(受保护的类型不能有远程访问类型,因为它们没有标记)。 对于所有被重写的函数(但不是过程),我都会收到相同的消息: 相关代码如下: package Safira.Documents with Remote_Types, Spark_Mode =>

我正在开发一个数据库管理系统(数据库管理软件)完全在Ada和DSA。 但是我遇到了一些问题;行被实现为文档(MongoDB样式),它们是受保护的接口,然后作为受保护的类型在同一个包中实现。 我必须先把它做成一个接口,这样它才有可能有一个远程访问类型(受保护的类型不能有远程访问类型,因为它们没有标记)。 对于所有被重写的函数(但不是过程),我都会收到相同的消息:

相关代码如下:

package Safira.Documents with Remote_Types, Spark_Mode => On, Elaborate_Body is
   
   type Update_Value_Operation is 
     access procedure 
       (K : in     Key;
        V : in out Value);
   
   type Base_Document is protected interface;
   -- Documents live in Storage_Nodes only. Clients access them through remote
   -- access types.
   -- This allows them to be declared as protected types with trustworthy atomic
   --  operations that won't corrupt their content.
   
   type Base_Document_Xs is access all Base_Document'Class;
   
   -- << Many subprograms for the interface here >>
   
   protected type Document is new Base_Document with
      
      overriding function Is_Version_Controlled return Boolean;
   
      overriding procedure Set_Mirror 
        (N : in     Nodename_String.Bounded_String);
   
      overriding procedure Remove_From_Mirror 
        (N : in     Nodename_String.Bounded_String);
   
      overriding procedure Set_Contents 
        (D : in     Dictionary'Class);
   
      overriding function Get_Contents return Dictionary'Class;
   
      overriding procedure Revert_To 
        (Version : in     Document_Version);
   
      overriding function Get_Version 
        (Version : in     Document_Version)
         return Dictionary'Class;
   
      overriding procedure Delete_Version 
        (Version : in     Document_Version);
   
      overriding procedure Define_New_Origin 
        (From : in     Document_Version);
   
      overriding procedure Delete_Entire_History;
   
      overriding procedure Clone_From 
        (Origin  : access Document);
   
      overriding procedure Clone_From 
        (Origin  : access Document;
         Version : in     Document_Version);
   
      overriding function Has_Key 
        (K : in     Key) 
         return Boolean;
   
      overriding procedure Set_Value 
        (K : in     Key;
         V : in     Value'Class);
   
      overriding function Get_Value 
        (K : in     Key) 
         return Value'Class;
   
      overriding procedure Update_Value 
        (K : in     Key;
         V : in     Value'Class);
   
      overriding procedure Update_Value 
        (K  : in     Key;
         Op : in     Update_Value_Operation);
   
      overriding function Get_Id return Document_Id;
   
      overriding function Get_Location return Nodename_String.Bounded_String;
   
      overriding function Database return Blueprint_String.Bounded_String;
   
      overriding function Collection return Blueprint_String.Bounded_String;
   
      overriding function Get_Creation_Time_As_Dictionary 
        return Dictionary'Class;
   
      overriding function Get_Last_Update_Time_As_Dictionary 
        return Dictionary'Class;
      
   private
      
      Contents : Dictionary;
      
   end Document;

end Safira.Documents;
package Safira.Documents with Remote_type,Spark_Mode=>On,Body是
类型更新\u值\u操作为
访问程序
(K)钥匙;
V:输入输出值);
类型Base_文件是受保护的接口;
--文档仅存在于存储节点中。客户端通过远程访问它们
--访问类型。
--这允许它们被声明为具有可信原子的受保护类型
--不会损坏其内容的操作。
类型Base_Document_Xs是access all Base_Document'Class;
-- >
受保护类型文档是具有
重写函数为\u版本\u受控返回布尔值;
覆盖过程集\u镜像
(N:在节点名字符串中。有界字符串);
覆盖过程从\u镜像中删除\u
(N:在节点名字符串中。有界字符串);
重写过程集\u内容
(D:在字典课上);
重写函数Get_Contents return Dictionary'Class;
覆盖过程还原为
(版本:文件中的版本);
重写函数Get\u Version
(版本:文件中的版本)
返回字典类;
覆盖过程删除\u版本
(版本:文件中的版本);
覆盖过程定义新原点
(来源:文件版本中);
覆盖过程删除整个历史记录;
覆盖过程克隆\u自
(来源:访问文件);
覆盖过程克隆\u自
(来源:访问文件;
版本:在文件(U版本)中;
重写函数具有\u键
(K:钥匙)
返回布尔值;
覆盖过程设置值
(K)钥匙;
V:价值级);
重写函数Get_值
(K:钥匙)
返回值类;
重写过程更新_值
(K)钥匙;
V:价值级);
重写过程更新_值
(K)钥匙;
Op:在更新_值_操作中);
重写函数Get\u Id返回文档\u Id;
重写函数Get_Location返回Nodename_String.Bounded_String;
重写函数数据库返回Blueprint\u String.Bounded\u String;
重写函数集合返回蓝图\u字符串。有界\u字符串;
重写函数Get_Creation_Time_As_Dictionary
返回字典类;
重写函数Get\u Last\u Update\u Time\u As\u Dictionary
返回字典类;
私有的
目录:字典;
结束文件;
结束萨菲拉文件;
将那些
access
参数转换为接口规范中的
in
参数(显然)解决了问题。但我不知道这是否会破坏远程功能。我在internet上找到的所有远程类型示例都使用远程类型方法的访问参数

显然,接口的函数期望访问常量参数(即实际参数),我没有要求它,所以我确信这是Ada默认的安全/安全特性

现在。。。我是否可以在不中断远程功能的情况下,将
access
参数更改为
in
参数?如果没有,有没有办法避免这种默认行为(换句话说,让他们访问可变参数)? 我发现的所有远程类型的示例都使用了
access
参数,因此我担心将它们转换为
in
参数的解决方案可能会使它们成为普通(非远程)方法,这将使此包在分布式应用程序中作为远程类型变得无用。我可以试着让它纯净,但不知道这是否容易做到

注:它应该在将来(当它准备好的时候)是开源的,所以如果我真的需要,我现在可以发布整个文件或整个项目。
我不喜欢在我的项目准备好之前发布它们,但是如果有必要让某人找到解决方案的话。。。我会的。

您没有提供受保护函数的配置文件,但似乎缺少访问参数的
常量
关键字:

type PI is protected interface;
function Is_Version (Self : access constant PI) return Boolean
   is abstract;

protected type D is new PI with
     overriding function Is_Version return Boolean;
private
   Ok : Boolean;
end D;
对于远程类型的
in
vs
access
,应该没有
接口/受保护类型的区别在于,在Ada中,它们无论如何都是通过引用传递的。

是的,这很有效。非常感谢。我真的不习惯使用
访问常量
。有时我甚至不记得它的存在。lol Ada是我的主要语言,我仍然忘记了新手级别的东西,比如她如何通过引用传递对象。我很尴尬。。。
type PI is protected interface;
function Is_Version (Self : access constant PI) return Boolean
   is abstract;

protected type D is new PI with
     overriding function Is_Version return Boolean;
private
   Ok : Boolean;
end D;